LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Programatically change cursor location(s) on xy graph set by x-value

Hello,

I have an xy graph with some data on it and at least one cursor. I'm trying to set the location of the cursors based on some other data. I only know the x position of where the cursor should be. Is there a way to do this programatically? I've made a simple VI to demonstrate what I'm trying to do right now, but it isn't working. The way I'm doing it right now is just unbubdling the x position of the cursor and then putting that back into the cursor list, and this almost works. The cursor does change its location, but not to the correct x location that I try to set it. Do I need to also know the y value?

To reiterate, I want to programatically set the location of a cursor on an xy graph based only on the x location of where I want it.

0 Kudos
Message 1 of 4
(3,755 Views)

I cannot view your VI, but you should be able to set the active cursor and then the x location using the a property node for the graph.

0 Kudos
Message 2 of 4
(3,733 Views)

Given an xy graph, the x-axis is not necessarily non-descending, so for any given x there could be an infinite amount of Y values.

 

In your case, the x-values are equally spaced, so simply use a waveform graph instead.

0 Kudos
Message 3 of 4
(3,728 Views)
  • If you want any x, you need a free cursor. A cursor locked to a plot can only be on actual points.
  • Your code is a "one shot" deal. I hope you are not using continuous run mode.
  • Your use of the IPE followed by initialize array is completely crazy. Why do you index out the cursor and position if you never use that data?

If you want to move the cursor based on some computed or set value, just write to the cursor position property.  (if you have multiple cursor, set the active cursor first)

 

Attached is a simple example. See if it can give you some ideas.

 

0 Kudos
Message 4 of 4
(3,721 Views)