Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 496
Ryan Avatar asked Feb 18 '23 23:02

Ryan


1 Answers

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.

like image 76
Dan D. Avatar answered Apr 09 '23 13:04

Dan D.