Place Line Cursor using a mouse click

A forum dedicated to WinForms version of LightningChart Ultimate.

Moderator: Arction_LasseP

Posts: 8
Joined: Tue Mar 27, 2018 2:16 pm

Place Line Cursor using a mouse click

Post by mobusek » Tue Mar 27, 2018 2:24 pm

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?

Posts: 392
Joined: Mon Mar 14, 2016 9:22 am

Re: Place Line Cursor using a mouse click

Post by ArctionKestutis » Wed Mar 28, 2018 2:11 pm


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

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

All the best.