Pre loader

Get X,Y Max and min values from Chart

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

0
0

Hi I currently do need to get two things for which I currently have no clue how to get it.

I’m using FastLineRenderableSeries and XyDataSeries<double,double> in SciChart 2D.

1st: The absolute min and max values from an curve.

What I found is that I can get the YMax/YMin and XMax/XMin, but that is not what I need.

-> I need to get the “Point” (x, and y value) where the maximum/minimum is.

2nd: I Need the X-value of an Y-Value (or the list of x-values if the y-value does exist more than once).
Lets say I have the y-Value “5” and want to know at which x-value this is.

Is there a fast and elegant way to get this information from existing RenderableSeries via the SciChart API, or Do I need to get this information from my data source before appending the curves?

Thanks,
Ben

Version
4.2.3
  • You must to post comments
0
0

Hi Bernd

It’s as simple as

 double yMax = double.MinValue; 
 int indexMax = -1;
 IList<double> yValues = DataSeries.YValues as IList<double>
 for(int i = 0; i < DataSeries.Count; i++)
 {
      double yCurrent = yValues[i];
      if (yCurrent > yMax) 
      {
            yMax = yCurrent; 
           indexMax = i;
      }
 }

 double xMax = (double)DataSeries.XValues[indexMax];

Best regards,
Andrew

  • Bernd Held
    Thanks Andrew. I had a different complicated idea at first, but this is a good solution for me. Best regards, Ben
  • 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