LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Center multi-point cursor in a XY graph

Hi all,

 

i need to programmatically bring to center the only cursor of a XY graph (a multi-point cursor made of 4 plots).

 

I realized an algorithm to calculate the x value to send to the "Cursor.Cursor position:Cursor X" property of the graph.

 

The cursor seems to be correctly set, but i resets instantly. Seems like i need to set the property for every 4 plots, but i don't know how.

 

Any clue?

 

Thanks

 

Marco

0 Kudos
Message 1 of 8
(3,742 Views)

What do you mean by "resets instantly"?  Does it change when the graph updates?  Please post your code.

>

"There is a God shaped vacuum in the heart of every man which cannot be filled by any created thing, but only by God, the Creator, made known through Jesus." - Blaise Pascal
0 Kudos
Message 2 of 8
(3,738 Views)

@aRCo wrote:

(a multi-point cursor made of 4 plots).


A cursor is not made of plots. Is the cursor locked to a plot (single, multi) or is it free?

 

We need to see some code.

0 Kudos
Message 3 of 8
(3,729 Views)

Here's the code.

 

The strange behaviour described in the first post is replicated: after clicking the "Center cursor" button, the multi-point cursor is centered, but it soon resets its position (i.e. it place itself in correspondance of the first sample).

 

Note that deleting the multi-point cursor and creating a new single-point one, the behaviour is not replicated and the cursor is correctly centered, without resetting its position.

0 Kudos
Message 4 of 8
(3,708 Views)

Se the "cursor index" property and set it to half the number of X points. (or use more complicated math if the graph is zoomed, not shown)

 

(All your booleans should be latch action, eliminating all local variables. You also don't need the reference. There probably also should be a small wait.)

 

(All that said, I never use multiplot cursors, but maybe there is a bug somewhere if they are used. Your code works fine if the cursor is locked to a single plot)

0 Kudos
Message 5 of 8
(3,702 Views)

Thanks, setting "Cursor.Index" property solved the problem.

 

A question about the modifications you did on my code. Why you replaced the "Bundle Cluster" function with the composition of "Re/Im to Complex" and "Build Cluster Array" functions? Is there an efficiency reason or is it the result of your presonal preference?

0 Kudos
Message 6 of 8
(3,692 Views)

No, I just like it better. Less clutter. 😉

 

Overall, your x-points are spaced equally, so a plain waveform graph (after setting x0 and dx) or even a chart would probably be sufficient. An XY graph seems overkill! You could just set the wait time to 1s or even use a timed loop. There are also probably better way to implement the buffer. Try to operate in-place.

0 Kudos
Message 7 of 8
(3,679 Views)

In this simplified version they are, but the definitive one gives the user the possibility to modify the wait time, meaning that dx can vary. It also contain in-place structures (one for each plot), where the operations of adding and deleting are realized.

 

Thanks

0 Kudos
Message 8 of 8
(3,668 Views)