iOS图表缩放属性 [英] iOS Charts zoom property

查看:49
本文介绍了iOS图表缩放属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用iOS图表库,在我的应用程序中,我的条形图视图可能会有很多x轴值,但是,我只需要显示其中一些即可.我尝试使用 barChartView.setVisibleXRangeMaximum(12)来做到这一点,尽管这会引起一些奇怪的问题.(就像条形图的条形图填充所有x轴一样)我没有使用该功能,而是尝试使用zoom属性 barChartView.zoom(scaleX:4,scaleY:0,x:0,y:0).但是,我不确定在绘制图表时会出现多少x轴值.在某些情况下,它是60,84或800.如何计算正确的缩放比例以显示10-12(它们之间的任何数字对我来说足够)x轴值?

I am using iOS charts library and in my application there could be lots of x axis values for my bar chart view but, I need to show few of them. I have tried to do it with barChartView.setVisibleXRangeMaximum(12) though it is causing some weird issues. (Like Bar chart's bar fill all x-axis) Instead of using that function I am trying to use zoom property barChartView.zoom(scaleX: 4, scaleY: 0, x: 0, y: 0) . However, I am not sure how many x axis values come when I draw the chart. In some cases, it's 60,84 or 800. How can I calculate right zoom ratio to accomplish for showing 10-12(any number between them enough for me) x-Axis values?

推荐答案

您可能要使用:

barChartView.setVisibleXRange(minXRange: 10.0, maxXRange: 12.0)

代替:

barChartView.setVisibleXRangeMaximum(12.0)

这篇关于iOS图表缩放属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆