Java – Add the % symbol to the Y-axis labels in the bar chart AChartEngine

Add the % symbol to the Y-axis labels in the bar chart AChartEngine… here is a solution to the problem.

Add the % symbol to the Y-axis labels in the bar chart AChartEngine

I’m developing an Android app and making diagrams using AChartEngine. Bar charts are plotted based on dynamic data from the server.

Y-axis labels are set to display from 0 to 100, and no labels are displayed as 11 s
0..10..20.30..40.60..70..80..90..100 as the Y-axis label. Is it possible to set a custom Y-axis label so that a “%” symbol is added after the Y-axis title value for display

0%.. 10%.. 20%.. 30%.. 40%.. 60%.. 70%.. 80%.. 90%.. 100% as the Y-axis label value.

How??

Solution

All you need to do is: enjoy 😉

renderer.addXTextLabel(0, "0");
    renderer.addYTextLabel(10, "10%");
    renderer.addYTextLabel(20, "20%");
    renderer.addYTextLabel(30, "30%");
    renderer.addYTextLabel(40, "40%");
    renderer.addYTextLabel(50, "50%");
    renderer.addYTextLabel(60, "60%");
    renderer.addYTextLabel(70, "70%");
    renderer.addYTextLabel(80, "80%");
    renderer.addYTextLabel(90, "90%");
    renderer.addYTextLabel(100, "100%");

renderer.setYLabels(0);

Related Problems and Solutions