How to automatically scroll the mpadroidchart line chart?
I'm a new user of MP Android chart in Android. Who can help me?
resolvent:
So what you want to do is always show 10 values in the chart, no matter how many values are stored in the LineData object?
You can do this by limiting the view on the horizontal (x) axis and then aligning the view with the data you want to display. Therefore, you need to call
setScaleMinima((float)lineData.getXValCount()/ 10f,1f)
This will limit the view on the x-axis and always display 10 values. You can then set the target position of the view by calling
centerViewPort(float val,int xindex)
If centerviewport (500F, 11) is called, the view will aim at the 11th value on the y value 500 (vertical axis) and the horizontal (x) axis
If it helps you, please let me know
to update:
In newer versions above 2.0.0, see the Wiki to learn how to modify viewports