Example Code

Moving Cursor Graph

Products and Environment

This section reflects the products and operating system used to create the example.

To download NI software, including the products shown below, visit ni.com/downloads.

    Software

  • LabVIEW

Code and Documents

Attachment

Download All

Overview:

This example creates a multiplot waveform graph with cursors that follow the movements of the mouse while staying attached to the corresponding plot. The effect created is similar to the graphs on Google Finance.

 

Description:

The Moving Cursor Graph allows users to visually match data points with the actual values of those points and compare those values across multiple plots. An event structure is used to find the coordinates of any mouse movements, and those coordinates are transformed to graph coordinates using a simple proportion. Using property nodes, the cursors are then moved to those new graph coordinates. Another property node is used to find the Y-value of the plot at that X-coordinate, and the value is written to an indicator. A for loop is then used to repeat this process for each plot included on the graph.

 

The Moving Cursor Graph creates a more interactive front panel: adding form as well as function. The VI could be wrapped into an X-control, which could then be easily implemented into existing front panels.

 

Moving Cursor Graph Snippet.png

 

Steps to Implement

1. Download the proper version of the VI

2. Run the VI

3. Move the mouse over the graph and watch the cursors follow the movements.

 

Required Software

LabVIEW 2010 or newer

David S.

Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.

Comments
Raeff
Member
Member
on

Thanks a lot!

Your VI pointed me to the solution of locking a created cursor to the nearest plot, such that it not always jumps back to plot 0 when dragged!

Simple once I found the property nodes: Active Cursor (ActCsr) and cursor.Cursor Plot

Working with LV2011, LV2018 and LV2020
Tepig
Active Participant
Active Participant
on

This method has a bit of complexity. I couldn't understand how to calculate "125" and "559".

 

Getting X position by this way is easier way.

mouse position over waveform graph

Certified LabVIEW Developer
There are only two ways to tell somebody thanks: Kudos and Marked Solutions

GCentral