Force BarChart Y axis labels to be integers?

后端 未结 8 739
滥情空心
滥情空心 2021-02-05 11:47

I\'ve created a BarChart using MPAndroidChart and I\'m entering the data dynamically. This means that I need my Y axis to also be determined dynamically. All of my data is repre

8条回答
  •  清酒与你
    2021-02-05 12:13

    Allright, now I see your problem. THe problem is that the YAxis (YLabels) determines the number of digits and thus the steps between each label automatically.

    Unfortunately it's currently not possible to customize how the axis computes itself or set custom labels.

    I am considering to add such a feature in the future, where the user can self define which values are drawn as the axis labels.

    Just a hint:

    The mEntries array that holds all the axis labels is public. So in general, you could modify it after it has been created. However, I am absolutely not sure how the axis will behave if you manually modify it.

    But maybe its worth a try :-) https://github.com/PhilJay/MPAndroidChart/blob/master/MPChartLib/src/com/github/mikephil/charting/components/YAxis.java

提交回复
热议问题