How to set Viewport Range via values at MpAndroidC

2019-08-19 02:02发布

问题:

I have dataset values at range [0-10000].
And I want to see range [500-600] at chart with automatically calculated scroll and zoom values.
How it can be done in MPAndroidChart?

Is there any method to setXRange(leftXValue, rightXValue)?

回答1:

First set the max visible range. So if you want to display the range of 500-600, set a max visible range of 100

mChart.setVisibleXRangeMaximum(100);

than you have to move your view so that the values are visible from the 500th position

mChart.moveViewToX(499);