dev.farmer
dev.farmer

Reputation: 2809

MPAndroidChart setGranularity(1.0f) doesn't work

I really thanks to this library. I am trying to draw Horizontal Bar Chart.

But I faced a problem. I want to draw the chart Axis every one point. So I used "setGranularity(1.0f);"

But the Axis is shown every 2 points. When I use "setGranularity(3.0f)" or higher, it works fine. But 1.0 doesn't work. I don't know why. And I can find a clue.

When the size of "List" is smaller than 8, "setGranularity(1.0f)" works fine.enter image description here

When the size of "List" is bigger than 9, "setGranularity(1.0f)" doesn't work. (It works like "setGranularity(2.0f)".)enter image description here

I have the List size of 13.

How can I apply "setGranularity(1.0f)"?

Upvotes: 1

Views: 3308

Answers (1)

dev.farmer
dev.farmer

Reputation: 2809

I found the solution.

When I called below method, "setGranularity(1.0f)" works fine.

barChart.getXAxis().setLabelCount(12);

Upvotes: 7

Related Questions