LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to move x and y cursors with mouse cursor proportionally in labview anyone?

Solved!
Go to solution

I'm able to control the x and y cursors via slide but I'm trying to figure out how to setup hovering with mouse to move the x and y cursors

Screenshot 2021-10-31 113235.pngScreenshot 2021-10-31 113246.png

0 Kudos
Message 1 of 5
(2,940 Views)

LabVIEW Graphs have a "Cursor" associated with them.  You can learn about them using LabVIEW Help.  The quickest way to the most useful part is to do the following:

  1. Start LabVIEW.
  2. Click Help (Menu Bar), LabVIEW Help ...
  3. Choose the Index Tab.
  4. Type "cursors" (the final "s" is important).
  5. Choose the first sub-entry, "adding to graphs".  Read, learn, try it out for yourself.

Bob Schor

0 Kudos
Message 2 of 5
(2,909 Views)

I read through it and did the examples already. I tried to look on google and youtube for more specific help. I'm trying to free drag real time with my mouse cursor.

0 Kudos
Message 3 of 5
(2,903 Views)

You failed to attach your code (files ending in .vi) so I can't see what you did.  I don't understand what you mean by "free drag real time with my mouse cursor".

 

I just made a little VI that generates 30 random numbers as an Array and writes it to a Waveform Graph.Graph Cursor FP.png

To get the Cursor to appear, I right-clicked on the Graph, chose "Visible Items", and selected "Cursor Legend", which gave me a blank Cursor Legend.  I then right-clicked the Cursor Legend and chose "Create Cursor", specifying "Single Plot" (as I want the Cursor "linked" to the Plot).  I haven't played with the Cursor "Style", so it shows up as a pair of Yellow Lines that intersect on points in the plot.  With my mouse, I dragged this Cursor to the right and "dropped" it at X = 18, and it tells me Y = 0.17223.  

 

Did you read the LabVIEW Help section I mentioned to you?  Did you try something like "Add cursor to graph in LabVIEW" in a Google search?  What did you try?

 

Bob Schor

 

0 Kudos
Message 4 of 5
(2,871 Views)
Solution
Accepted by topic author Kentvuong1998

The cursor position property values correspond to the x/y scale of the trace that it is attached to, while the mouse coordinates are in pixels relative the the origin of the pane, so you need to do some translation. Additionally, since you can only get an event for a mouse move over the entire control, you probably want to check that the mouse move event occurred on the actual plot first.

 

Something like this should work if you just want the x-position of the active cursor to follow the position of the mouse.

 

Cursor Auto Positioning.png

Message 5 of 5
(2,859 Views)