I am using MPAndroidChart library. Anybody has this problem? When I put the labels in BOTTOM position, these are cut.
Thank you
To avoid clipping of legend values use the following block of code
Legend legend=lineChart.getLegend();
legend.setWordWrapEnabled(true);
Doc (for legend):
/**
* Should the legend word wrap? / this is currently supported only for:
* BelowChartLeft, BelowChartRight, BelowChartCenter. / note that word
* wrapping a legend takes a toll on performance. / you may want to set
* maxSizePercent when word wrapping, to set the point where the text wraps.
* / default: false
*
* @param enabled
*/
public void setWordWrapEnabled(boolean enabled) {
mWordWrapEnabled = enabled;
}
To avoid clipping of x-axis labels use
XAxis xAxis = lineChart.getXAxis();
xAxis.setAvoidFirstLastClipping(true);
Doc (for x-axis labels):
/**
* if set to true, the chart will avoid that the first and last label entry
* in the chart "clip" off the edge of the chart or the screen
*
* @param enabled
*/
public void setAvoidFirstLastClipping(boolean enabled) {
mAvoidFirstLastClipping = enabled;
}