I would like to get the Y-value of a graph, corresponding to an X-value given as input.
Noting that the given X-value may not necessarily be within the input table of X versus Y values, meaning that some kind of interpolation may be needed to compute the Y-value, is there a SciChart API for getting this Y-value corresponding to a given X-value? Rather than me performing the interpolation through code. Thanks.
There’s a couple of things to consider here to give you a good answer.
If you’re trying to find the y-value of a series (see attached image), then do this
If you’re trying to do it based on a x-coordinate (not x-value) then I suggest using the Hit-Test API. Specifically RenderableSeries.HitTestProvider.VerticalSliceHitTest provides an X-First method of searching for y-values.
Which one of those sounds right for you? Do they answer your question?
As a follow up to this question I have the same question but the answer is not clear to me. I am using the FindIndex(_cursor1Date, SearchMode.RoundDown) method on an XYDataSeries for a given x data value as defined by a cursor position on the chart.
The index I receive is the nearest index rounded down and when I use that index on the yValues I am not receiving the data point at the specified x data value but the nearest sampled value correct?
Like the original poster mentioned, I would have to do the same interpolation as the chart to get the actual value between two data samples like the chart draws.
Note, I am setting the IsDigitalLine property to false and the XYDataSeries does not have a HitTestProvider property to be able to use the VerticalSliceHitTest() method.
Please login first to submit.