Example Code

Show Live Data on 3D or XY Graph with Buffer Using 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 VI shows a technique to display live data on 3D or XY Line Graph with a memory buffer

 

Description

This is a code example that shows a technique to display live data on a 3D or XY Line Graph with a memory buffer. An application of this could be tracing a path through a space. The VI allocates space in memory using the Initialize Array VI with the Buffer Size and 0's as data.Then it compares the iteration counter with the buffer size. If it is bigger or equals the iteration count, then it deletes the oldest array entry. Then it adds the newest data to X,Y, and Z buffers and send X,Y and Z buffers to shift register to preserve history. Finally, it outputs to 3D Line Graph. This example gives pseudo-Chart like behavior to 3D or XY Graph.

 

Requirements

LabVIEW 2012 (or compatible)

 

Steps to Implement or Execute Code

  1. Run the VI 

Additional Information or References

XY Line Graph VI Block DiagramShow Live Data on XY Graph with Buffer LV2012 NI Verified BD.jpg

 

3D Line Graph VI Block DiagramShow Live Data on 3D Graph with Buffer LV2012 NI Verified BD.jpg

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

Dustin D

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

Comments
GroovyGeek
Member
Member
on

This is a very clever and elegant workaround, with two caveats related to the same issue.  First, it always plots the (0,0) point regardless of what the first actual data point is.  Second,  the maximum  physical size of the X and Y buffers being allocated is twice what is given by the "Buffer Size" parameter.  This is because the shift registers appends to the externally defined buffer instead of just writing into it.  The solution to the first problem is to get the size of the X and Y buffers at each step and then peel off only the last i+1 data points with a subarray command (i is the loop iteration counter).  I don't seem to have privileges to attach files to my post, but would be happy to share the modified VI with anyone who asks.