Showing results for 
Search instead for 
Did you mean: 

Coercing a cursor to specific values

Go to solution

Hi everybody.


  I wrote a code that records the values of the cursor on an XY graph. I do not want the measured values to exceed certain ranges, which is easily done by coercing them, but I also want to make sure the cursor itself does not "leave" the desired range. I tried to do this by simply testing if the value from the cursor was out of the desired range and if so, assigning the coerced value to it. However, every time any value is assigned to the cursor in the property nodes, it simply goes to (0,0). Even if only the x or only the y are assigned, the cursor goes to (0,0). I set the cursor to single-plot and prevent the plot from scrolling.  

  I attach the diagram. Can anybody help?

0 Kudos
Message 1 of 6

There is no need to constantly set the scale range. Disable autoscale and disable "advanced:cursors scroll graph". Since the limits correspond to the scale, no programming is needed. If needed you could use an event structure with a "cursor move" event to reset the positions of you get out of a desired range.


(Typically it help if you would attach your VI. It is difficult to debug a code image. Closing a direct reference is also not needed. How exactly does the graph receive data? The terminal seems disconnected. Your wait connects to a constant with the wrong datatype)

0 Kudos
Message 2 of 6

Thanks. I tried what you suggested but it still does not change the behavior. I attach the vi.

0 Kudos
Message 3 of 6

I even wrote a much simpler VI, that does nothing except input 5 to the X and Y of the cursor of an XY graph just once, and it still sends the cursor to (0,0) regardless of the values inputted to it.

0 Kudos
Message 4 of 6
Accepted by ronenGabizon

Your cursor is locked to a plot, but the plot has no data. You need to have a free cursor to place it at random locations.

Message 5 of 6

Thanks, setting the cursor as free did the trick.

0 Kudos
Message 6 of 6