title: How can I reverse values in MPAndroidChart?
body: <p>Right now I am using your <a href="https://github.com/PhilJay/MPAndroidChart" rel="nofollow noreferrer">library</a> to display some data obtained from two API calls in a Horizontal BarChart. I am saving the values in two ArrayLists of BarEntries and then drawing the chart.
  My issue is that I would like to reverse the order of the bars, so its descending from highest to lowest.
  Is it possible to change the order, after the entries have been added to the ArrayList of BarEntries?So i have done reverse,but some issues the values are not proper.
  Please look on my code,</p>
  
  <pre><code>     class Top10UsersChartDetails extends AsyncTask&lt;String, Void, String&gt; {
  
          @Override
          protected void onPreExecute() {
              super.onPreExecute();
          }
  
          @Override
          protected String doInBackground(String... params) {
              String response = null;
              try {
                  response = apiDetails.Top10UsersChartFunc(params[0], params[1]);
              } catch (Exception e) {
  
              }
              return response;
          }
  
          @Override
          protected void onPostExecute(String s) {
              super.onPostExecute(s);
  
              try {
                  JSONObject resObj = new JSONObject(s);
                  String status = resObj.getString("status");
                  String Month = resObj.getString("Month");
                  Log.e("status", status);
                  Log.e("Month", Month);
                  leaderBoardTV.setText("BEER LEADER BOARD - "+Month);
                  if (status.equalsIgnoreCase("Success")) {
                      JSONArray userdataDetailsArray = resObj.getJSONArray("userdata");
                      Log.e("userdataDetailsArray::", userdataDetailsArray + "");
                      for (int j = 0; j &lt; userdataDetailsArray.length(); j++) {
                          JSONObject CampaignDetailsArrayObject = userdataDetailsArray.getJSONObject(j);
                          String userId = CampaignDetailsArrayObject.getString("userId");
                          String UserName = CampaignDetailsArrayObject.getString("UserName");
                          String CountRunning = CampaignDetailsArrayObject.getString("Count");
                          String position=CampaignDetailsArrayObject.getString("position");
                          Log.e("CountRunning",CountRunning+"");
                          Log.e("CountRunning1",Float.parseFloat(CountRunning)+"");
                          float floatCountUser = Float.parseFloat(CountRunning);
                          int positionsUser= Integer.parseInt(position);
                          if(userID.equals(userId)&amp;&amp;j&gt;=9){
                              yourPOsitionTV.setVisibility(View.VISIBLE);
                              String yourDetail="YOU (at "+positionsUser+") with "+CountRunning+" beer";
                              Log.e("yourDetail",yourDetail+"");
                              yourPOsitionTV.setText(yourDetail);
                          }else {
  //                            BARENTRY1.add(new BarEntry(fp1, j));
  //                            BarEntryLabels1.add("User#" + position);
                              BARENTRY1.add(new BarEntry(floatCountUser, positionsUser));
                              BarEntryLabels1.add("User#" + positionsUser);
                          }
                          Collections.reverse(BARENTRY1);
                      }
                      horizontalBarChart.notifyDataSetChanged();
                      horizontalBarChart.invalidate();
                      Bardataset = new BarDataSet(BARENTRY1, "Projects");
                      BARDATA = new BarData(BarEntryLabels1, Bardataset);
                      Bardataset.setColors(new int[]{Color.parseColor("#701112")});
                      horizontalBarChart.setData(BARDATA);
                      horizontalBarChart.setDrawBarShadow(false);
                      horizontalBarChart.setDrawValueAboveBar(true);
                      horizontalBarChart.setPinchZoom(false);
                      horizontalBarChart.setDrawGridBackground(false);
                      horizontalBarChart.setDescription("");
                      Bardataset.setBarSpacePercent(10f);
                      Legend legend = horizontalBarChart.getLegend();
                      legend.setEnabled(false);
                      horizontalBarChart.setTouchEnabled(false);
                      XAxis xAxis1 = horizontalBarChart.getXAxis();
                      xAxis1.setPosition(XAxis.XAxisPosition.BOTTOM);
                      xAxis1.setTextSize(8);
                      xAxis1.setSpaceBetweenLabels(8);
                      xAxis1.setTextColor(Color.parseColor("#701112"));
                      xAxis1.setTypeface(tf);
                      YAxis leftAxis = horizontalBarChart.getAxisLeft();
                      leftAxis.setEnabled(false);
                      Collections.reverse(BARENTRY1);
                      Collections.reverse(BarEntryLabels1);
                      Log.e("BARENTRY1",BARENTRY1+"");
                      Log.e("BarEntryLabels1",BarEntryLabels1+"");
                  } else {
                      String message=resObj.getString("message");
                      apiDetails.logoutCheck(message, getActivity(), mEditPrefs, loginPref);
                  }
              } catch (Exception e) {
              }
  
          }
      }
  
   Please look on to this,Where am doing mistake here? 
  </code></pre>