Здесь я получил свой ответ с динамическими данными;
ArrayList<String> horlyXaxis = new ArrayList<>();
for (int i = 0; i < jsonResult.getJSONObject("Data").getJSONArray("HourlyOffer").length(); i++) {
horlyXaxis.add(jsonResult.getJSONObject("Data").getJSONArray("HourlyOffer").getJSONObject(i).getString("Percentage"));
}
ArrayList<BarEntry> horlyYaxisUsers = new ArrayList<>();
ArrayList<BarEntry> horlyYaxisRevenue = new ArrayList<>();
for (int i = 0; i < jsonResult.getJSONObject("Data").getJSONArray("HourlyOffer").length(); i++) {
horlyYaxisUsers.add(new BarEntry(Integer.parseInt(jsonResult.getJSONObject("Data").getJSONArray("HourlyOffer").getJSONObject(i).getString("UserCount")),
(float) Integer.parseInt(jsonResult.getJSONObject("Data").getJSONArray("HourlyOffer").getJSONObject(i).getString("UserCount"))));
}
for (int i = 0; i < jsonResult.getJSONObject("Data").getJSONArray("HourlyOffer").length(); i++) {
horlyYaxisRevenue.add(new BarEntry(Integer.parseInt(jsonResult.getJSONObject("Data").getJSONArray("HourlyOffer").getJSONObject(i).getString("OrderAmount")),
(float) Integer.parseInt(jsonResult.getJSONObject("Data").getJSONArray("HourlyOffer").getJSONObject(i).getString("OrderAmount"))));
}
BarDataSet barDataSet1, barDataSet2;
barDataSet1 = new BarDataSet(horlyYaxisUsers, "No of Users");
barDataSet1.setColor(Color.RED);
barDataSet2 = new BarDataSet(horlyYaxisRevenue, "Total Revenues($)");
barDataSet2.setColor(Color.BLUE);
BarData barData1 = new BarData(barDataSet1, barDataSet2);
barWidth = 0.5f;
barSpace = 0.00f;
groupSpace = 0.0f;
barData1.setValueFormatter(new LargeValueFormatter());
half_hourly_bar_chart.setData(barData1);
half_hourly_bar_chart.getBarData().setBarWidth(barWidth);
half_hourly_bar_chart.getXAxis().setAxisMinimum(0);
half_hourly_bar_chart.getXAxis().setAxisMaximum(horlyXaxis.size());
half_hourly_bar_chart.groupBars(0, groupSpace, barSpace);
half_hourly_bar_chart.getData().setHighlightEnabled(false);
half_hourly_bar_chart.invalidate();
Legend legend = half_hourly_bar_chart.getLegend();
legend.setPosition(Legend.LegendPosition.BELOW_CHART_RIGHT);
legend.setWordWrapEnabled(true);
//X-axis
XAxis xAxis1 = half_hourly_bar_chart.getXAxis();
xAxis1.setGranularity(1f);
xAxis1.setGranularityEnabled(true);
xAxis1.setCenterAxisLabels(true);
xAxis1.setLabelRotationAngle(0);
xAxis1.setPosition(XAxis.XAxisPosition.BOTTOM);
xAxis1.setValueFormatter(new IndexAxisValueFormatter(horlyXaxis));
//Y-axis
half_hourly_bar_chart.getAxisRight().setEnabled(false);
YAxis axisLeft = half_hourly_bar_chart.getAxisLeft();
axisLeft.setValueFormatter(new LargeValueFormatter());
axisLeft.setDrawGridLines(false);
axisLeft.setSpaceTop(35f);
axisLeft.setAxisMinimum(0f);
axisLeft.setGranularity(1.0f);
axisLeft.setGranularityEnabled(true);