LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Position Cursor on GRAPH either by dragging it OR entering the dsired position in the Cursor legend

I've written a VI that allows the user to import a dataset, view it on a graph, and then use cursors to "filter" the range of data that I'm interested in, by sending the cursor.index values from the first graph to an array subset function which feeds a second graph.  The problem is that I'd like to provide the user the ability to position the cursors on the first graph both visually - by dragging - (for "course" control) AND by entering the desired values directly into the cursor legend (for fine control).  The problem is that I cannot find a way to do this, since I have to have the Lock Ring set to “Lock to Plot” in order to capture the index information. According to the documentation, the only way to be able to position the cursors via the Cursor legend is to set the Lock Ring to “Free”, which means the index values are rendered useless, since the cursor is no longer locked to the plot.  If I leave the Lock Ring in "Lock to Plot", and enter a value in the cursor legend, it does move the cursor, but not to where it should.  If I enter a value an x value of 9.0 for cursor 1, the cursor goes to 10.2638.  The next time I enter 9.0, it goes to 9.82794.  I don't understand what the issue is.  Is there a way around this?

 

0 Kudos
Message 1 of 7
(3,396 Views)

Dan:

I am not sure I completely understand what you are trying to achieve. With a cursor, you would like to be able to set the cursor position by entering x & y coordinates, as well as freely move the cursor around on the graph. Is this correct?. Please let me know so that I can better assist you.

Regards,

Rudi N.

0 Kudos
Message 2 of 7
(3,381 Views)

Yes Rudi:  What I want is for the operator to place the cursors by dragging them (just eye-balling it).  The, if they see that the Y cursor (horizontal) is at 10.234, and they want to make it 10, they could simply enter that value in the cursor legend, and the cursor would be placed exactly at 10.  The only way to do this seems to be to select the “Free” option for the cursor.  However, in order to use the first graph to set the boundaries of the second graph, I have to use the Cursor Index from the first as an input to the Array Subset that feeds the second graph.  In order to use the Cursor Index, the first graph has to have its cursor Lock Rings set to “Lock to Plot”.  Am I making this any more understandable, or just rambling?

0 Kudos
Message 3 of 7
(3,371 Views)
I understand your problem and it seems to me that the cursor behaviour you describe is a bug.
It seems that, (in "lock" mode) instead of going to the X_0 position you enter in the cursor legend, the cursor goes to the closest point close to X_0 while trying to keep Y as close as possible to the previous value.

To get around this bug you should create your own cursor legend (just need 1 control to enter the X position) and then change the cursor position using the property node (you will also have to switch to the free mode before doing that using also the prop node).

Yes... you reinvent the wheel, but this one is round!
0 Kudos
Message 4 of 7
(3,371 Views)
This poses a problem.  If I go to "Free" mode, then I lose the Cursor Index data, which is the whole reason for using the first graph in the first place.  I use the markers on the first graph to determine the region whose data I ultimately want to save.  I'm using this to allow the operator to eliminate "noise" visually.  As they move the cursors on the first graph, the Cursor Index of the first marker, as well as the difference betweeen the two, is fed to the Array Subset function, where it's used to set the index and length of the array that feeds the second graph.  In this way, the operator visually picks the range of values that they want to save, sets the cursors to those values and hit "Accept Values".  I just want to be able to allow them to move the cursors by dragging them with the mouse AS WELL AS entering exact values in the cursor legend.
0 Kudos
Message 5 of 7
(3,359 Views)
I am not sure what your X data looks like so this may not work.  But if it is non-descending you do not need to use the array index.  Instead use the Threshold 1D array VI.  Give it the X array and the Cursor.PosX it will return the fractional index of that value, and you can then use that as the array index to grab the subset.  You can then allow the user to type or drag.
0 Kudos
Message 6 of 7
(3,356 Views)
from your VI, I wrote something as I explained you that solve your problem!
It is a quick and dirty code but it works.
Use the control "index A" to change the X-value of the cursor A.
 
Nicolas
0 Kudos
Message 7 of 7
(3,349 Views)