How do I change only the data in Android mpchart?

13 Views Asked by At

enter image description here

I want to fix the X-axis to around 14k and update only the data like in the graph above. What should I do? I am updating only the entries as below, but it does not work well.

How can I freeze the X-axis and only update the values?

ArrayList<BarEntry> entries = new ArrayList<>();
String title = "Title";

for(int i=0;i<10000;i++)
{
    entries.add(new BarEntry(i,0));
}
// The value I want to update
entries.add(new BarEntry(500,200));

BarDataSet barDataSet = new BarDataSet(entries, title);

BarData data = new BarData(barDataSet);
barChart.setData(data);
barChart.notifyDataSetChanged();
barChart.invalidate();
0

There are 0 best solutions below