LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Is it possible to link a variable to a graph cursor or vice versa? I want to be able to change the graph cursors and have their values be used in another calculation.

Hello,

 

I have an application where I am sampling some data from an FPGA. I want to be able to select an area of the graph with the cursors and have the position of those cursors then be used in a calculation. Is this possible?

Message 1 of 16
(2,452 Views)

From your Graph, you can create a Property Node of Cursor. From there you can use Cursor List Property to get an array of information about the cursors on the plot area, including positions. From the X and Y position of two Cursors, you can determine a rectangle, and thus what the cursor is measuring.

Richard






0 Kudos
Message 2 of 16
(2,444 Views)

I would recommend a "cursor move event". Keep the two positions as an array of two positions (cluster of xy) in a shift register, and replace the respective values based on the cursor index and new xy positions from the event terminals (CursIdx & CurseLoc).

 

After replacement, use the values from the shift register to recalculate whatever needs to be done. 😉

 

Here's a very quick draft:

 

 

(Note that the FOR loop on the left shows also how to get both positions without all the extra baggage of the cursor list property.)

0 Kudos
Message 3 of 16
(2,437 Views)

This was very  helpful, thanks to you both.

 

Michael

0 Kudos
Message 4 of 16
(2,429 Views)

@altenbach wrote:

[..]

 

(Note that the FOR loop on the left shows also how to get both positions without all the extra baggage of the cursor list property.)


What baggage? It ain't much brother. I'm not much for creating events to get data that already exists out in space. Good thing Michael marked his own reply as the Solution, or I'd be sore and all. Smiley Tongue

 

I resemble that remark.png


 

Richard






0 Kudos
Message 5 of 16
(2,417 Views)

Its my first post, I thought it was a generic 'accept thread as having a solution' button. Not 'mark this reply as solution'. 🙂 Sorry! I'm trying both!

0 Kudos
Message 6 of 16
(2,411 Views)

@WyndyPickle wrote:

Its my first post, I thought it was a generic 'accept thread as having a solution' button. Not 'mark this reply as solution'. 🙂 Sorry! I'm trying both!



It's all good! Welcome to the Froums. Good first question.

Richard






0 Kudos
Message 7 of 16
(2,405 Views)

@broken Arrow wrote:
What baggage?


Form the problem description it sounded like he want to interactively change the cursors at any time, so an event structure seems appropriate. How else would you trigger reading the updated positions?

 

The cursor list is a huge data structure. I prefer to surgically get only what I need, but that's just me. 😄

Why get all these items if we only want the position? 😮 That's like ordering a sandwich "with everything"  if all you want is a slice of cheese. ;))

 

 

I am glad that there are many different ways to do things...

 

 

0 Kudos
Message 8 of 16
(2,402 Views)

Well one other thing .. my graph has two cursors... i want to set the position of the X-axis of one as the minimum and the other X-axis value as the maximum. When I try and create a property node, and select Cursor ... all I get is cursor 1 ... how do I get to the additional cursors on the graph?

 

Nevermind.. I found the Cursor List attribute.

0 Kudos
Message 9 of 16
(2,392 Views)

@WyndyPickle wrote:

[...]

 When I try and create a property node, and select Cursor ... all I get is cursor 1 ... how do I get to the additional cursors on the graph?

[..] 


Just so you know, look at Altenbach's example above - look at the Property Node inside the For Loop on the left. You have to set the Active Cursor before asking for Position. 0 = first, 1 = second, etc.

Richard






0 Kudos
Message 10 of 16
(2,379 Views)