I built a graph using MPAndroidChart, but there is a problem - values on x-axis overlap.
Is there a way to fix it? Something like a margin between x-axis values?
It's been a while since you've posted your question and probably by now you found your way around this problem, however, I'm posting this answer for anyone else who has faced this issue.
Setting
chart.getXAxis().setSpaceMin(0.5f);
would add space between the X-axis line and the chart itself. you can also use
chart.getXAxis().setSpaceMax(0.5f);
for adding space between the last value and the right X-axis of the chart.
Here is an example of a normal chart and this one is a chart with min and max space of 1.5.
By the way, I'm using MPAndroidChart V3.0.2.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With