I use the library MPAndroidChart to draw a bar chart.
I have the following problem: When I have more than 4 or 5 bars in my chart x label is not drawed properly.

How can I resolve this issue?
I use the library MPAndroidChart to draw a bar chart.
I have the following problem: When I have more than 4 or 5 bars in my chart x label is not drawed properly.

How can I resolve this issue?
Increasing the space between labels can make the labels displace from the bars center position, however you can try spacing.
if spacing doesn't give you expected result ellipsis the label using this function.
public static String ellipsize(String input, int maxCharacters) {
if (input == null || input.length() < maxCharacters) {
return input;
}
return input.substring(0, maxCharacters - 3) + "...";
}
and implement IAxisValueFormatter to get the formatted text
xAxis.setValueFormatter(new IAxisValueFormatter() {
@Override
public String getFormattedValue(float v, AxisBase axisBase) {
if((int)v != -1 && (int)v < xAxisValues.size())
return ellipsize(xAxisValues.get((int)v),10);
else
return "";
}
});