iOS图表设置最大可见x轴值 [英] IOS-Charts set maximum visible x axis values
本文介绍了iOS图表设置最大可见x轴值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用ios图表(
我已经尝试过:
让图表= LineChartView()
chart.dragEnabled = true
chart.setVisibleXRangeMaximum(5)
让xAxis = chart.xAxis
xAxis.axisMinValue = 0
xAxis.axisMaxValue = 5.0
xAxis.setLabelsToSkip(0)
但是仍然可以同时看到所有11个值。我怎么只能看到5?
解决方案
我终于明白了!
正确的答案是:
chart.setVisibleXRangeMaximum(5)
但这需要在之后设置,已在图表中设置数据(而不是在之前的配置中)
这帮了我大忙
I'm using ios-charts (https://github.com/danielgindi/Charts). I have a LineChartView with 12 values in the x axis. This however is far too many to see at the same time, so I want to display only 5 and then let the user drag to the right to see the next.
I've tried this:
let chart = LineChartView()
chart.dragEnabled = true
chart.setVisibleXRangeMaximum(5)
let xAxis = chart.xAxis
xAxis.axisMinValue = 0
xAxis.axisMaxValue = 5.0
xAxis.setLabelsToSkip(0)
But still see all 11 values at the time. How can I only see 5?
解决方案
I finally got it!
The correct answer is:
chart.setVisibleXRangeMaximum(5)
This however needs to be set after the data has been set in the chart (not in a configure before)
This did the trick for me
这篇关于iOS图表设置最大可见x轴值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文