Example Code

XY Multiplot Chart from XY 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

Overview
This example shows in greater depth how to program this functionality especially with multi-plot data.

Description:
This application plots 2 simulated (constant ) sets of data as if it were taking 1 sample per hour in a 24 day period. In other words 1 X array corresponding to time and 2 Y arrays are fed to a for loop which contains the XY graph.
In order to achieve XY chart functionality out of a XY graph we need to add the ability to hold history and display data as it gets generated in a loop instead of graphing after a data generation loop is complete. In other words, graphs are used outside of loops and charts are used within loops. This functionality is implemented utilizing shift registers (to hold history) and array indexing to insert a new data point.

The key concepts:
Feeding in constant data
Using Initialized Shift registers to save history for the graph
Using Indexing to insert the next data point into the stored history
The ability to control the X scale utilizing property nodes
The fact that we are using a for loop because we are feeding constant data. You would likely use a while loop which is generating data either point by point or sets of data at a time(DAQ, File I/O ect). With a while loop you would still need to initialize the history shift registers but would not have arrays entering the loop.

Instructions:
To implement this example:

  1. Run the VI
  2. (Optional) Turn on the Highlight Execution to see the flow of the VI

To execute this example:

  1. Install the required software.
  2. Open the VI and refer the Implement Steps


Requirements
Software
LabVIEW 2012 or compatible

Hardware
-

bd.pngfp.PNG

**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.