Hi,
How can i get to first and last items indexes on visible range when onVisibleRangeChanged triggered?
Tnx.
- Dunya Biralem asked 4 years ago
- You must login to post comments
Hi Dunya,
It depends on what type of XAxis do you use:
- If it’s category axis then VisibleRange already contains range of indices. Then you just need to round its Min/Max to nearest int value to get data point indices.
-
If it’s value axis (e.g. NumericAxis or DateAxis) then you need to search for the closest value – for Min/Max values of VisibleRange find index in target DataSeries:
int minIndex = dataSeries.getXValues().findIndex(min, SearchMode.Nearest);
int maxIndex = dataSeries.getXValues().findIndex(max, SearchMode.Nearest);
Also you can get xIndexRange from RenderableSeries’s CurrentRenderPassData which contains range of data points which are within chart’s viewport and should be rendered by RenderableSeries:
final IndexRange xPointRange = ((SeriesRenderPassData) rSeries.getCurrentRenderPassData()).xPointRange;
Hope this will help you!
Best regards,
Yura
- Yura Khariton answered 4 years ago
- You must login to post comments
Please login first to submit.