Mpandroidchart: set space between labels in x-Axis

Created on 29 Nov 2016  路  4Comments  路  Source: PhilJay/MPAndroidChart

I have a long string as a label so my labels overlap. It would look good if I reduce the no of labels or set the spacing between labels. I couldn't find any related to that issue. pl reply Asap

Most helpful comment

Hi..
I solved it with this
XAxis xAxis=chart.getXAxis();
xAxis.setLabelCount(4,true);

Just reduce the label count
Let me know whether it helped @sebastiande

All 4 comments

+1

In my case 30 data points with dates (2016-12-12) on a Nexus 5X.

Hi..
I solved it with this
XAxis xAxis=chart.getXAxis();
xAxis.setLabelCount(4,true);

Just reduce the label count
Let me know whether it helped @sebastiande

The above mentioned works, but only if the data are numbers/dates. If your data is series (for example, strings such as "Apple", "Orange", "Banana"), then only 4 of those string values would be seen. The rest would only show up if user zooms in the graph. But, when a user looks at this graph, he has no idea that there are more values there, he just sees 4 fruits and nothing else.

@dxshindeo then make the graph extend off the screen by restricting the view port

Was this page helpful?
0 / 5 - 0 ratings

Related issues

vishvendu picture vishvendu  路  3Comments

AndroidJiang picture AndroidJiang  路  3Comments

mrZizik picture mrZizik  路  3Comments

Nima9Faraji picture Nima9Faraji  路  3Comments

chathudan picture chathudan  路  3Comments