01-18-2018 02:42 PM
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?
Solved! Go to Solution.
01-18-2018 03:06 PM - edited 01-18-2018 03:09 PM
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)
01-18-2018 03:30 PM
Thanks. I tried what you suggested but it still does not change the behavior. I attach the vi.
01-18-2018 03:37 PM
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.
01-18-2018 07:16 PM
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.
01-19-2018 03:58 PM
Thanks, setting the cursor as free did the trick.