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?
Asked
Active
Viewed 5,510 times
4

Ryan
- 1,331
- 2
- 12
- 18
2 Answers
8
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
.

Dan D.
- 32,246
- 5
- 63
- 79
-
1@dan hii i have same problem but i cant find the method XYMultipleSeriesRenderer in this class object.so any lib or any thing else.. i am facing same problem my x-label touches the y label in corner.so tell me the review? – Google Sep 13 '13 at 05:52
-
Thanks it works. These functions are now included in the newest version 1.1.0: https://code.google.com/p/achartengine/downloads/list – ThomasH Jul 22 '14 at 20:31
-
It kinda sucks, it's not compatible with other jars from achartengine – DennisVA Oct 02 '14 at 15:11
0
Add below lines
multiRenderer.setYLabelsAlign(Paint.Align.RIGHT);
multiRenderer.setMargins(new int[]{0, 70, 0, 0});
multiRenderer.setYLabelsPadding(15);

Deepak Sharma
- 4,999
- 5
- 51
- 61