Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Mp Android Chart Scrolling the data from right to left

I'm Building a barchart using MpAndroid chart library, i've around 50 - 60 bars and wanted to display the 60th initially i.e. display the last element in the ArrayList and the scroll should be from right to Left.

Main motive is to display the end of the chart during the initial load of the chart barchart.

Thanks in Advance.

like image 512
Ranjith Naidu Avatar asked Nov 09 '15 09:11

Ranjith Naidu


1 Answers

This worked for me.

chart.setData(...); // first set data

// now modify viewport
chart.setVisibleXRangeMaximum(20); // allow 20 values to be displayed at once on the x-axis, not more
chart.moveViewToX(10); // set the left edge of the chart to x-index 10
// moveViewToX(...) also calls invalidate()

Check this for more information, doc

like image 162
sauvik Avatar answered Sep 30 '22 18:09

sauvik