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

Welcome to the SciChart Community Forums!

Please use the forums below to ask questions about SciChart. Take a moment to read our Question asking guidelines on how to ask a good question and our support policy

We also have a tag=SciChart on Stackoverflow.com where you can earn rep for your questions!

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.