Example Code

Overlay New Data on Graph with Initial Data Set in LabVIEW

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

Overview

This example shows how to display an initial data set and then overlay new data as it is generated. The build array functions are used to create a 2D array that can be accepted as an input to a Waveform Graph indicator.

 

Description

Multi plot waveform graphs can be built in several ways. The method used in this example is to build a 2D array of 1D data, each row being a separate plot, and output it as a waveform graph indicator.

 

The initial data is an existing array of points. A For loop is used to generate a number of random points with values between 0 and 8, which are then built into an array. The Wait (ms) function introduces a delay in each iteration of the For loop which allows you to see the graph being updated when the VI is run. 

 

Requirements

LabVIEW 2012 (or compatible)

 

Steps to Implement or Execute Code

1. Run the attached example.
2. Observe the red overlayed data being added to the graph at a rate of 1 point every 200 ms.
3. If you wish, you can edit the initial data values in the control on the Front Panel.
4. Run the VI again. Observe that the overlayed data is randomly generated so you will get different values each time you run.

 

  

Additional Information or References

 

Front Panel of the VI

Capture.PNG

 

 Block Diagram of the VI

Overlay Data on Waveform Graph 2012 NIVerified Block Diagram.png

This VI can be modified for acquisitions by removing the random number generator and adding any sort of data read operation. If there is no maximum number of iterations, the For Loop can be Replaced with a While Loop and a Stop Button.

 

Other methods of building multi plot graphs are demonstrated in the example Waveform Graph.vi found under Help >> Find Examples...

 

 **This document has been updated to meet the current required format for the NI Code Exchange.**

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