Pre loader

Get visible range indexes?

Welcome to the SciChart Forums!

  • Please read our Question Asking Guidelines for how to format a good question
  • Some reputation is required to post answers. Get up-voted to avoid the spam filter!
  • We welcome community answers and upvotes. Every Q&A improves SciChart for everyone

WPF Forums | JavaScript Forums | Android Forums | iOS Forums

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.

Try SciChart Today

Start a trial and discover why we are the choice
of demanding developers worldwide

Start TrialCase Studies