I\'ve created a BarChart using MPAndroidChart and I\'m entering the data dynamically. This means that I need my Y axis to also be determined dynamically. All of my data is repre
Here is the simple solution which will benefit someone who is looking for the answer.
Y-Axis labels count
barChart.getAxisLeft().setLabelCount(7, true); //if you want 6 labels then value should be 7
Calculate maxValue
maxValue
from values need to be included in the chartint maxValueMod = (maxValue + 2) % 6; //calc mod, here 2 is to display Legend and 6 is no of labels
maxValue = maxValue + (6-maxValueMod); // calculate final maxValue to set in barchart
barChart.getAxisLeft().setAxisMaximum(maxValue+2); ```