2017-05-06 137 views
0

我真的很感谢library。 我想绘制水平条形图。MPAndroidChart setGranularity(1.0f)不起作用

但我遇到了一个问题。 我想绘制图表轴每一个点。 所以我用“setGranularity(1.0f);”

但是轴每2点显示一次。 当我使用“setGranularity(3.0f)”或更高版本时,它工作正常。 但1.0不起作用。 我不知道为什么。 我可以找到一个线索。

当“List”的大小小于8时,“setGranularity(1.0f)”正常工作。 enter image description here

当“List”的大小大于9时,“setGranularity(1.0f)”不起作用。 (它的工作原理就像 “setGranularity(2.0F)”。)enter image description here

我有13

列表的大小如何我申请 “setGranularity(1.0F)”?

回答

1

我找到了解决方案。

当我在下面调用方法时,“setGranularity(1.0f)”正常工作。

barChart.getXAxis().setLabelCount(12); 
+0

干得好找到你自己的解决方案!你可能还需要'barChart.getXAxs()。setGranularityEnabled(true)' –