LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to fix cursor at one particular value X?

Solved!
Go to solution

Hi,

I am having an XY graph where I want to select a range of X values by seeing the XY graph. I want to lock 2 cursors on 2 different values of X(X1 and X2) in the XY graph. Now when I am using 'lock to plot' option of cursor, then with the variation of data, the cursor is changing its X position as well. Is there any way that I can fix X values for both the cursors?

Thank you

0 Kudos
Message 1 of 14
(3,289 Views)

Whenever the cursor changes, You can write the desired x position back to a property node. (use a cursor changed: event)

 

altenbach_1-1582485975572.png

 

 

 

(Not that you probably should not lock the cursor to a plot, because then you cannot change y independent of x. Keep it free-dragging)

0 Kudos
Message 2 of 14
(3,247 Views)

Of course you can also simply disallow dragging so their x-position can only be set via code.

 

Hard to tell what's the correct solution without more information.

 

altenbach_0-1582490312247.png

 

0 Kudos
Message 3 of 14
(3,236 Views)

What exactly happens if we lock the cursor to plot? I tried using the cursors on a sign wave generated by a function generator, but the cursors were moving abruptly. Hence I locked them to the plot. But I could not understand their behavior.

0 Kudos
Message 4 of 14
(3,214 Views)

A locked cursor can only be on data points. Easiest to see if you move the cursor left/right by grabbing the vertical cursor line.

0 Kudos
Message 5 of 14
(3,199 Views)
Solution
Accepted by topic author Ben121

Since you're doing this seemingly to select a region of interest, you might want to change the style of a cursor such that it only displays a vertical line.

You can right click on the cursor panel and choose various settings on the attributes. You could also remove the point, but I can't immediately see a way to get a continuous line in that case...

cursor.png

 

This makes your locking (or not) setting less important.

 

As altenbach suggested, you can programmatically set the cursor X location when the autoscaling moves the axis if you want - you could also disable autoscaling and handle it manually, but that probably requires quite a bit more thought and programming.

 

I've attached an example that shows some possible solution. It is backsaved to 2015. It should be fairly straightforward to add an event to the Event Structure, triggered by a new button, to get the values from the graph between the two X limits.


GCentral
0 Kudos
Message 6 of 14
(3,191 Views)

Thank you for all the replies. I have incorporated some changes.

I tried to select X values using 2 cursors and then use it for further calculation (VI is attached). But I am facing 2 problems here.

 

1. when I run it continuously and move the cursor, the X position of cursor is not changing. It is changing in the cursor legend but not changing the the X position of cursor list. I want to select the X position manually while running the VI such that, if I move the cursor, the X position change immediately.

 

2. I am also fitting the data using polynomial fit. Why the Y values are becoming negative? Because whenever we fit some data points in general, the fitted curve lies closest to data points. I actually want to see both the unfitted and fitted data in one graph. But since the Y axes of both the plots are very far, I unable to see them. I am attaching the data file also here.

 

Please provide some help or guidance for the same. Thank you in advance.

0 Kudos
Message 7 of 14
(3,169 Views)

Here are the files.

Download All
0 Kudos
Message 8 of 14
(3,168 Views)

I tried using active cursor as well. No success. But the same thing is working for a waveform graph. I need to use an XY graph though. Please help.

0 Kudos
Message 9 of 14
(3,160 Views)

It works just fine until the code is trapped in the inner loop (bad architecture!). Once in the inner loop, the outer controls and cursor properties will not get read until the inner loop completes and the outer loop can go to the next iteration.

 

btw, you only need exactly one property node:

 

altenbach_0-1582742109078.png

 

 

0 Kudos
Message 10 of 14
(3,144 Views)