ViewXY: Cursor with SnapToPoints=true, setting X Value

A forum dedicated to WinForms version of LightningChart Ultimate.

Moderator: Arction_LasseP

greggorob64
Posts: 183
Joined: Tue Mar 18, 2014 2:55 pm

ViewXY: Cursor with SnapToPoints=true, setting X Value

Post by greggorob64 » Tue Jul 01, 2014 8:12 pm

I have a view XY chart, with 1 cursor (snap to points=true). My X axis values are increasing monotonically (0,1,2...). I'd like to be able to enter a value, "set my cursor to X = 50000".

However, if the user enters 50000.123, i'd like it snap to [either nearest, or before/after] point. Can this be done?

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

Re: ViewXY: Cursor with SnapToPoints=true, setting X Value

Post by ArctionPasi » Wed Jul 02, 2014 10:58 am

The cursor in fact snaps to nearest point if you set lineSeriesCursor.ValueAtXAxis = 50000.123. The property value stays 50000.123, but the line renders in the position of 50000.

You can of course round the value in app side:

lineSeriesCursor.ValueAtXAxis = Math.Round(50000.123);
LightningChart Support Team, PT

greggorob64
Posts: 183
Joined: Tue Mar 18, 2014 2:55 pm

Re: ViewXY: Cursor with SnapToPoints=true, setting X Value

Post by greggorob64 » Wed Jul 02, 2014 12:34 pm

Thanks for the reply. I'll have to do it manually. In this example, it starts at zero and increasing monotonically, but i'll have other examples that could have any [delta] and [offset]. I'll need to make a method to manually resolve an x coordinate.