Getting Data From Plot

Oystein Bjorke 10 ár síðan 0
This discussion was imported from CodePlex

JasonWeise wrote at 2012-11-07 00:47:

Hi

I have a plot with 10 points and need to retrieve the data for the intermediate points from code much like the tracker does when clicking the plot series.

As an example...

I have 10 points making up the data points on a smoothed line series plot.

I need to be able to retrieve the data value for a point at an arbitrary point along the X-Axis (eg X=3.2) that falls on the smoothed plot.

I have looked through the code and cannot find a function that can retrieve this information easily without the user clicking the plot series.

Thanks in advance..

BTW: great plotting package, love it.


objo wrote at 2012-11-07 16:19:

The tracker only finds the nearest point, it does not interpolate. I don't think there is any interpolation functions implemented in the library yet.

But we need to add this for http://oxyplot.codeplex.com/workitem/10017.


JasonWeise wrote at 2012-11-07 19:20:

Hi 

Thanks for the reply.

How can this be the case when, if you click on the smoothed plot curve the tracker gives you an X,Y value that is not in the original data set (ie it is smooth interpolated between the points) 

For example if I have 5 data points in the plot within a smoothed line series and I click anywhere on the series "between" the points I get a value at that point I clicked displayed by the tracker. I want to be able to get that calculated value from the series in code without the user clicking the line series.

If I want the value of the plot 1/6 of the way between the points (2.5,24) and (3.4,35) I need to be able to get this info from the plot without the user having to click 1/6 of the way between the points.


objo wrote at 2012-11-07 19:36:

It finds the *nearest* point, not necessary the point at the x-value of your mouse cursor.

You find the code in OxyPlot\Series\XYAxisSeries.cs method GetNearestInterpolatedPointInternal