I just hope that someone here can explain how to change the order of the HorizontalBarChart, which is shown in the MPAndroidChart screenshot (so instead of 44.0 it’s located at the top, it will be at the bottom).
The code below shows how I create a BarDataSet, which is used to create a 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 tried changing the for loop so that the dataset was added in the opposite way, but it seems that the same HorizontalBarChart is being created.
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");
Hope someone can show me a way to reorder this chart.
, . , . , (. )
mChart.getAxisLeft().setInverted(true);

