Display the Coordinates When the Mouse Hovers over the Curve of the Graph

Updated Nov 4, 2023

Environment

Software

  • LabVIEW
  • LabVIEW Professional

After display the waveform data on the waveform graph, how to automatically display the coordinates of the corresponding point when the mouse is placed on the curve of the waveform graph?

  1. Create an event structure, select Waveform Graph as Event Source, select Mouse Move as Events, click OK as shown in the figure below.
  2. Get the coordinates of the mouse from the event data node by creating an invoke node on the graph at the front panel for Map Coordinates To XY as shown in figure below.

    Right click on the Waveform Graph, select Create >> Invoke Node >> Map Coordinates To XY

  3. Create an invoke node on the graph at the front panel for Get Plot At Position as shown in figure below.                    Right click the on Waveform Graph, select Create >> Invoke Node >> Get Plot At Position
  4. Create an string indicator and create a Property Node for Visible, Position and Value as shown in figure below.    Right click the String Indicator, select Create >> Property Node >> Visible. Repeat the same for Position and Value
  5. Wire the Coordinates Data Node from event structure to the input of  Map Coordinates To XY Invoke Node. Use Unbundle function to extract the X and Y coordinates value. Convert the value into string format using Number To Fractional String. Display the string indicator when mouse is on the curve of the graph. The block diagram are as shown below.               
The results are shown below:

Additional Information

We can actually compile the function above as a XControl. So even the VI had stopped executing, user still able to get the coordinates information. 

In order to create a XControl, you have to copy the Waveform Graph and the String indicator to the Façade.vi front panel. For block diagram, you need to create a new mouse move event as shown below. 

Place the Waveform Graph inside the Data Change event state as below.