LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Using Cursors - snap to point

Hello everyone,
I would like some explanation on cursor functionality. I have a cursor on an x-y graph and I would like to use the drag function or enter the co-ordinates and have the cursor snap to this point.
My x-scale is set in 0.1 increments. I would like to only enter the x co-ordinate and have the cursor snap to the appropriate x-y co-ordinate on the selected plot. If I set it programatically using the 'cursor.posx' property node, the cursor moves to an x co-ordinate 0.1 below the one I set.
any ideas would be appreciated.
thanks.
Message 1 of 6
(3,660 Views)
Apparently, I don't have this kind of problem. Try to compare the attached vi with your own to find out the origin of the different behaviours.

CC
Chilly Charly    (aka CC)
0 Kudos
Message 2 of 6
(3,651 Views)
There is nothing that I can see in your example to my test vi, except for the data generated. If you have the time, can you please take a look at my vi, Im probably missing something very simple.

thanks
David
0 Kudos
Message 3 of 6
(3,639 Views)
David,

The difference is that your points are unevenly-spaced along the X axis, and charly's weren't. The easiest solution for you is to use the Cursor >> Cursor Index property instead of Cursor >> Cursor Position >> Cursor X. If you set this property to 0, the cursor will snap to the first point; 1 snaps it to the second point, 2 to the third, and so on.

You will have to change your UI a little bit if it's critical to display the actual X value, but since the X value is actually shown in the cursor palette, maybe you can just change your control to say "data index" or something and be satisfied.

--John
Message 4 of 6
(3,630 Views)
HAAAAAAAAAAAAAAAAA !

That's a nice one !!!

Just modify the scale of your graph, to display only a limited range of points, for instance 0 to 5. Things work perfectly there... Or similarly, on my example, set the X axis to 0-10. Things are going nuts ! Stop the vi, and increase the size of the graph, keeping the scale to 0-10. Rerun it. Works fine again !!!!

The problem is apparently related to the distance in pixels between the X positions. Since local time is 2.5 am, I'll leave this challenging issue to somebody else !!!

Thanks for this enlighting question. I'll have nice dreams !!!

CC
Chilly Charly    (aka CC)
0 Kudos
Message 5 of 6
(3,617 Views)
In this KB you can see that it is not recommended to use the Cursor>>X-Position property in this case. Attached to this post is a snapshot of one way you might use the Cursor.Index property to implement the behavior you are looking for.

Scott Y
NI
0 Kudos
Message 6 of 6
(3,595 Views)