I haven't actually done a lot with AChartEngine, but a quick glance at the source code suggests you could extend BarChart
to accomplish what you're after.
Have a look at the getLabel(double label)
method located in AbstractChart
(BarChart
extends XYChart
, which on its turn extends AbstractChart
).
/**
* Makes sure the fraction digit is not displayed, if not needed.
*
* @param label the input label value
* @return the label without the useless fraction digit
*/
protected String getLabel(double label) {
String text = "";
if (label == Math.round(label)) {
text = Math.round(label) + "";
} else {
text = label + "";
}
return text;
}
I would start with something naive to see how that works out; e.g. simply append "%"
on the result of above:
@Override protected String getLabel(double label) {
return super.getLabel(label) + "%";
}
Only thing I'm not too sure about is whether the same method is used to generate labels for the X-axis. If that's the case, you'll probably need to do something slightly smarter to enable it just for the axis you're interested in.