Reputation: 53
I'm using the great mpandroidchart libs for drawing various graph in our apps and first of all I'm deeply sorry if this question will be redundat or stupid. Anyway, I have this BarChart which is drawing great except to the fact that i can't find a way to force the drawing of ALL XLabels. It just draw some of them and obviously if I pinch the view they are coming up but i would like to show them always, without the needs of zooming. Hope is much clear. Thanks
Upvotes: 1
Views: 1365
Reputation: 1052
I know the question is a bit older... But the posted solution didn't work for me. I used:
XAxis xa = chart.getXAxis();
xa.setLabelsToSkip(0);
And this worked perfectly! Hope it helps somebody ;)
Upvotes: 0
Reputation: 51411
Unfortunately there is no way to force draw all x-axis-labels. The chart will prevent overlapping labels from being drawn.
What you can do is reduce the space between the labels to the absolute minimum by calling:
XAxis xa = chart.getXAxis();
xa.setSpaceBetweenLabels(0); // space in characters
This will make sure the space between the labels is kept to a minimum. Default space between labels is 4 characters.
Upvotes: 2