title: MPAndroidChart: How to reverse the order of a HorizontalBarChart?
body: <p>Just hoping someone here could explain how to reverse the order of the HorizontalBarChart which is shown in the screenshot of <a href="https://github.com/PhilJay/MPAndroidChart" rel="noreferrer">MPAndroidChart</a> (so instead of 44.0 being at the top it'd be at the bottom).</p>
  
  <p>The code below shows how I create the BarDataSet which is used to produce the HorizontalBarChart.</p>
  
  <pre><code>ArrayList&lt;BarEntry&gt; yVals1 = new ArrayList&lt;BarEntry&gt;();
  for (int i = 0; i &lt; count; i++) {
              float val = (float) (Math.random() * range);
              yVals1.add(new BarEntry(i * spaceForBar, i * 4));
  }
  BarDataSet set1 = new BarDataSet(yVals1, "DataSet 1");
  </code></pre>
  
  <p>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.</p>
  
  <pre><code>ArrayList&lt;BarEntry&gt; yVals1 = new ArrayList&lt;BarEntry&gt;();
  for (int i = count-1; i &gt;= 0; i--) {
              float val = (float) (Math.random() * range);
              yVals1.add(new BarEntry(i * spaceForBar, i * 4));
  }
  BarDataSet set1 = new BarDataSet(yVals1, "DataSet 1");
  </code></pre>
  
  <p>Hopefully someone will be able to show me a way to reverse the order of this chart.</p>
  
  <p>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) </p>
  
  <pre><code>mChart.getAxisLeft().setInverted(true);
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/upvYG.png" rel="noreferrer"><img src="https://i.stack.imgur.com/upvYG.png" alt="Screenshot of HorizontalBarChart"></a></p>
  
  <p><a href="https://i.stack.imgur.com/JyOGd.png" rel="noreferrer"><img src="https://i.stack.imgur.com/JyOGd.png" alt="Screenshot of HorizontalBarChart with inverted left axis"></a></p>