问题
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.
回答1:
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
来源:https://stackoverflow.com/questions/33605808/mp-android-chart-scrolling-the-data-from-right-to-left