Page 1 of 1

Place Line Cursor using a mouse click

Posted: Tue Mar 27, 2018 2:24 pm
by mobusek
I'm working on moving our applications to the LightningChart and am hoping to preserve some existing behavior. When the user clicks anywhere on the chart, I want the appropriate Line Series Cursor to move to that location. The problem I'm having is trying to get interpolation to work with this.

As I'm handling a mouse click event, I only have X and Y coords. The Point Line Series class has methods for going from coords to nearest data points, but as far as I can tell they won't ever give an interpolated X-value. My goal is to somehow get an interpolated X-value from mouse coordinates so I can set the cursor.ValueAtXAxis property. Then get the corresponding interpolated Y values using series.SolveYValueAtXValue method. Is there any simple way to go about this? Is there another way I can move the cursor to the correct spot that I'm overlooking?

Re: Place Line Cursor using a mouse click

Posted: Wed Mar 28, 2018 2:11 pm
by ArctionKestutis
Hi,

There are various cursor tracking strategies illustrated in group of examples from our DemoApp -> XY -> 'CursorTracking'.

I believe that most suitable for you is

Code: Select all

Series.SolveNearestDataPointByCoord()
Please not that input argument is screen coordinates (not DIP units).

All the best.