Just hoping someone here could explain how to reverse the order of the HorizontalBarChart which is shown in the screenshot of MPAndroidChart (so instead of 44.0 being at the top it'd be at the bottom).
The code below shows how I create the BarDataSet which is used to produce the HorizontalBarChart.
ArrayList<BarEntry> yVals1 = new ArrayList<BarEntry>();
for (int i = 0; i < count; i++) {
float val = (float) (Math.random() * range);
yVals1.add(new BarEntry(i * spaceForBar, i * 4));
}
BarDataSet set1 = new BarDataSet(yVals1, "DataSet 1");
I have tried to reverse the for loop so the dataset would be added the reverse way but it seems that the same HorizontalBarChart is produced.
ArrayList<BarEntry> yVals1 = new ArrayList<BarEntry>();
for (int i = count-1; i >= 0; i--) {
float val = (float) (Math.random() * range);
yVals1.add(new BarEntry(i * spaceForBar, i * 4));
}
BarDataSet set1 = new BarDataSet(yVals1, "DataSet 1");
Hopefully someone will be able to show me a way to reverse the order of this chart.
I already have tried the code below which is what one of the answers suggested. I had previously found the exact same link they shared. This line of code flips the graph so it's on the other side (see second screenshot)
mChart.getAxisLeft().setInverted(true);