Page 1 of 1

How to get DataPoint from PointSeries

Posted: Wed Jun 25, 2014 6:49 am
by vifani
Hi,

Is there a way to get the DataPoint underlaying a SeriesPoint in a FreeformPointLineSeries?

Kind regards.

Re: How to get DataPoint from PointSeries

Posted: Wed Jun 25, 2014 7:17 am
by ArctionPasi
Hi,

- freeFormPointLineSeries.SolveNearestDataPointByCoord to solve nearest point to screen coordinate (mouse location)
- freeFormPointLineSeries.SolveNearestDataPointByValue to solve nearest point to X,Y value.

Re: How to get DataPoint from PointSeries

Posted: Wed Jun 25, 2014 7:33 am
by vifani
Hi,

I already used those functions but I have unexpected result.

Point p = e.GetPosition(sender as IInputElement);

double nearestPointXValue = 0;
double nearestPointYValue = 0;
int nearestIndex = 0;


bool result = poiPointsSerie.SolveNearestDataPointByCoord((int)p.X, (int)p.Y, out nearestPointXValue, out nearestPointYValue, out nearestIndex);

double xValue = 0;
double yValue = 0;
chart.ViewXY.XAxes[0].CoordToValue((int)p.X, out xValue, true);
chart.ViewXY.YAxes[0].CoordToValue((float)p.Y, out yValue);

result = poiPointsSerie.SolveNearestDataPointByValue(xValue, yValue, out nearestPointXValue, out nearestPointYValue, out nearestIndex);

Kind regards

Re: How to get DataPoint from PointSeries

Posted: Wed Jun 25, 2014 9:01 am
by ArctionPasi
Can you be more specific, what is unexpected?

Please take a look at "Scatter, point tracking" example in the demo app.