+1
Ülevaatamisel

How can I get Y axis value for a LineSeries based on a given X axis value?

henrik.nordgren 4 aastat tagasi API • uuendaja Oystein Bjorke 4 aastat tagasi 1
Hi!

We have a simple graph with two axis and a LineSeries of datapoints (about 30 points). How can I get the Interpolated Y value when given an actual X value (which I got from InverseTransform based on mouse coordinates)? I can't find a good method for doing that. Or can I somehow define a tracker for that curve and provide that with an X coordinate? Our only alternative is to skip using oxyplot for this and dig the source data manually, and use some interpolation algorithm on that. But it would sure be nice to get oxyplot to do the work since it has already plotted the graph. C# and Code behind is fine!
Ülevaatamisel
See the implementation of `LineSeries.GetNearestPoint`. I think you need to find the interpolated Y in screen space, then inverse transform to get the Y. Created a derived series since the `SmoothedPoints` property is protected.