What Is the Difference between Waveform Graphs and Waveform Charts in LabVIEW?

Updated Nov 7, 2023

Reported In

Software

  • LabVIEW

Issue Details

How do I know when to use a Waveform Graph or a Waveform Chart in LabVIEW? What is the difference between these two ways to display data? Which one do I use to see the data history?

Solution

Waveform Graphs and Waveform Charts differ in the way they display and update data:

  • A Waveform Graph accepts arrays of data in various forms, e.g. array, waveform, or dynamic data. It then plots all the received points at once. It does not accept single point values. When an array of points is wired to a waveform graph, it assumes the points are equally spaced out. By default, the starting X value and step size (t0 and dt) are 0 and 1 respectively. This can be changed in the properties of the graph or using property nodes.
  • A Waveform Chart remembers and displays a certain number of points by storing them in a buffer. When the buffer gets full, the chart starts overwriting the oldest points with new ones. As the data points become available, the Waveform Chart displays received data in addition to already existing points. You can write single or multiple data points to it at once. If we wire an array of points to the chart, it will append those points to the existing ones. You can display multiple plots on the same chart by wiring in a cluster of points or a 2D array containing waveform or dynamic data for each plot. For example, if you wire in a cluster of three points, one point will be added to each of the three plots.
The following block diagram illustrates the difference in functionality:
This image is a LabVIEW snippet, which includes LabVIEW code that you can reuse in your project.  To use a snippet, right-click the image, save it to your computer, and drag the file onto your LabVIEW block diagram.
 
Inside For Loop, a new random value is passed to the Waveform Chart for each iteration of the loop for 100 iterations. Auto-indexing is used to accumulate those values into an array which is then passed to the Waveform Graph.

Both result in the same output, but the Waveform Graph will update once after all data has been acquired, whereas the Waveform Chart will update 100 times while the program runs. Additionally, the Waveform Chart contains a history buffer. Run this code more than once to see its effect.

 

Handling Timestamps When Plotting Waveform Data

Waveform charts and Waveform graphs handle timestamps differently. Charts always consider the waveform timestamp, whereas graphs ignore timestamp by default. Consider the VI snippet below:
 
1D of WDT.png

We generate 4 different waveforms, 1 second apart from each other (different t0). Here is how both indicators handle this 1D array of waveforms by default.
 
first comparison.png

To make the Waveform Graph consider the timestamp, you need to uncheck the Ignore Timestamp attribute. To do that, right-click the Waveform Graph and select the option Ignore Timestamp from the shortcut menu. The plot should now look like this:
 
ignore timestamp unchecked.png

Additional Information

The waveform data type is essentially an array of points that also contains t0 and dt information. In this case, the Waveform Graph receives the t0 and dt contained within the waveform and displays the data accordingly. You can build your own waveform with data points, t0, and dt specified. You can also display multiple plots on the same Waveform Graph by wiring a 2D array of waveform or dynamic data to the graph.
waveform.png

You can set the length of the Chart History buffer (the number of points the chart will display) before the program runs.

To switch between a Waveform Graph and a Waveform Chart, you can right-click on the graph or chart, select Replace, and then select the item of choice from the Controls Palette. The following screenshot shows how to replace a Waveform Graph with a Waveform Chart:
 

A waveform chart expects the data to have a constant delta_t between each sample. XY graph assumes constant equal spacing unless given a 2-element cluster (x,y), where the x value is given explicitly.