Search code examples
androidachartengine

aChartEngine: How to add padding between the chart and the y-axis labels


I'm using aChartEngine to display a simple bar chart. I would like to add padding between the chart itself and the y-axis labels. The labels touch the border of the chart, which doesn't look too great. I know of the setMargins method of the XYMultipleSeriesRenderer class, but this just controls the outer margins of the chart as a whole. How would I do this?


Solution

  • You can change the alignment of the Y axis labels and you can change the font size and style, but you cannot change the padding between the labels and the chart itself.

    I have just added APIs for setting the padding for both X and Y axis.

    renderer.setXLabelsPadding(10);
    renderer.setYLabelsPadding(10);
    

    You can checkout the code from the AChartEngine SVN and build a jar file using ant dist.