Pre loader

Get range values from DataSeries

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
2
0

Hi,
I have some XyDataSeries<DateTime, double> showing some data on my chart. Also I have 2 vertical line annotations (red and blue) where I know the two DateTime values.

Is there a effective way to get the double values between this range of each XyDataSeries.

Regarrds Markus

Images
  • You must to post comments
Best Answer
2
0

Hi there,

Yes there is, you want to use the DataSeries.FindIndex method.

 int FindIndex(IComparable x, SearchMode searchMode)

Finds the index to the DataSeries at the specified X-Value, where

  • x = The X-value to search for
  • searchMode = The SearchMode Enumeration options to use. Default is exact, where -1 is returned if the index is not found

Then, you want to query the DataSeries.YValues[] array between these indices. make sure you cast your Dataseries to XyDataSeries<DateTime, Double> to get the strongly typed YValues array

Best regards,
Andrew

  • Rupertsberger Markus
    Hi, tried this but the problem is that I can only select SearchMode.Exact other modes will raise System.NotImplementedException (FindIndex() in not implemented for searchMode Nearest) . And the values from the VerticalLineAnnotations are not exact I think. Regards Markus
  • Andrew Burnett-Thompson
    this only occurs if the data in your chart is unsorted, which is a really bad idea since it reduces performance by an order of magnitude. Can you double-check?
  • Rupertsberger Markus
    Checked it. The DataSeries is unsorted. Thought it's sorted. Thank you for your help!!!
  • Andrew Burnett-Thompson
    No probs! Quick question: are you able to vote and mark as answer? I ask because Im not sure what permissions are for users. Best regards, Andrew
  • You must to post comments
Showing 1 result
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