How to get DataPoint from PointSeries

Need help in implementing some specific function to your LightningChart Ultimate powered application? Post a question and get code snippets from other LightningChart Ultimate community members.

Moderator: Queue Moderators

Post Reply
vifani
Posts: 49
Joined: Thu May 02, 2013 8:35 am

How to get DataPoint from PointSeries

Post by vifani » Wed Jun 25, 2014 6:49 am

Hi,

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

Kind regards.

User avatar
ArctionPasi
Posts: 1367
Joined: Tue Mar 26, 2013 10:57 pm
Location: Finland
Contact:

Re: How to get DataPoint from PointSeries

Post by ArctionPasi » Wed Jun 25, 2014 7:17 am

Hi,

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

vifani
Posts: 49
Joined: Thu May 02, 2013 8:35 am

Re: How to get DataPoint from PointSeries

Post by vifani » Wed Jun 25, 2014 7:33 am

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

User avatar
ArctionPasi
Posts: 1367
Joined: Tue Mar 26, 2013 10:57 pm
Location: Finland
Contact:

Re: How to get DataPoint from PointSeries

Post by ArctionPasi » Wed Jun 25, 2014 9:01 am

Can you be more specific, what is unexpected?

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

Post Reply