Solution
LabVIEW 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:
Note: 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:
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.
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: