Manually Clear Data
This method can be used on Charts or Graphs. For simplicity, the term Graph is used below.
- Open your LabVIEW VI which contains a Waveform Graph or Chart object.
- On the Front Panel, right-click the Graph and select Data Operations >> Clear Graph/Chart.
Programmatically Clear Data
There are multiple methods to programmatically clear data from a chart or graph. You can clear the Front Panel object using specific property nodes depending on whether a Waveform Chart or Waveform Graph is used. For either data type, you can use the Reinitialize to Default property node.
You can clear a chart programmatically by writing an empty array to its History Data buffer:
This writes an empty array of data to the chart, which will clear the history when this code is executed.
- On the block diagram, right-click the chart icon and select Create >> Property Node >> History Data.
- Note that the color at the top bar of the property node is determined by the data type used in the chart.
- Right-click the History Data property node and select Change to Write.
- Right-click the History Data Terminal and select Create Constant.
You can clear a graph programmatically by writing an empty array to its Value property:
This writes empty data to the graph which will clear the graph when this code is executed.
- Make sure the graph is clear by right-clicking the graph and choosing Data Operations >> Clear Graph.
- Right-click the graph and select Create >> Property Node >> Value.
- Right-click Value and select Change to Write.
- Right-click the Value Terminal and select Create Constant.
Reinitialize to Default
You can also use the Reinitialize to Default
method if you ensure that the default value for your graph is an empty array:
This method returns the front panel object to its default state.Note:
- Make sure the graph is clear by right-clicking the object in the front panel select Data Operations >> Clear Graph.
- Set this empty state as default by right-clicking the graph select Data Operations >> Make Current Value Default.
- On the block diagram, right-click the graph and select Create >> Invoke Node >> Reinitialize to Default.
This method cannot be used to clear a chart because the chart maintains a history of data, or buffer, from previous updates. To clear a waveform chart, you need to clear its history data rather than reinitialize it to a default value. To do this manually, you can right-click on a Waveform Chart and select Data Operations >> Clear Chart
. To do it programmatically, you need to write an empty array to its History Data buffer.