I am new user of MPAndroidChart in android. can any one help me ?
So what you want to do is always show 10 values in the chart, regardless of how many values are stored in the LineData
object?
You can do that by restraining the view on the horizontal (x) axis and then aim the view at the data you want to be visible. Therefore, you need to call
setScaleMinima((float) lineData.getXValCount() / 10f, 1f)
This will restrain the view on the x-axis and always show exactly 10 values. Then you can set where your view should aim at by calling
centerViewPort(float val, int xindex)
If you call centerViewPort(500f, 11), your view will be aimed at the y-value 500 (vertical axis) and on the 11th value on the horizontal (x) axis.
Please let me know if this helped you.
UPDATE:
In newer versions of the library above 2.0.0, please refer the wiki on how to modify the viewport.