Page 1 of 1

ViewXY: Cursor with SnapToPoints=true, setting X Value

Posted: Tue Jul 01, 2014 8:12 pm
by greggorob64
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?

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

Posted: Wed Jul 02, 2014 10:58 am
by ArctionPasi
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);

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

Posted: Wed Jul 02, 2014 12:34 pm
by greggorob64
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.