Reputation: 1331
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?
Upvotes: 4
Views: 5547
Reputation: 5073
Add below lines
multiRenderer.setYLabelsAlign(Paint.Align.RIGHT);
multiRenderer.setMargins(new int[]{0, 70, 0, 0});
multiRenderer.setYLabelsPadding(15);
Upvotes: 0
Reputation: 32391
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
.
Upvotes: 8