SciChart® the market leader in Fast WPF Charts, WPF 3D Charts, and iOS Chart & Android Chart Components

Answered
0
0

Hi,

How can i get to first and last items indexes on visible range when onVisibleRangeChanged triggered?

Tnx.

Version
3.0
  • You must to post comments
Best Answer
1
0

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

  • You must to post comments
0
0

@Yura;

Thanks for guiding.

  • You must to post comments
Showing 2 results
Your Answer

Please first to submit.