How To Clear A Chart or Graph Programmatically in LabVIE1
How To Clear A Chart or Graph Programmatically in LabVIE1
Primary Software:
Primary Software Version: 1.0
Primary Software Fixed Version: N/A
Secondary Software: LabVIEW Development Systems>>LabVIEW Full Development System, LabVIEW
Development Systems>>LabVIEW Professional Development System
Problem:
I have a chart and a graph on my front panel in LabVIEW, but the only way I can find to clear it is to right-click
the chart or graph and choose Data OperationsClear Chart or Data OperationsClear Graph from the
shortcut menu. Is there a way to clear the chart or graph programmatically?
Solution:
To clear a Waveform Chart programmatically, a Property Node must be used to clear the Chart History. For
more information, see KnowledgeBase 3VGFK1HY: Why Doesn't Reinitializing to Default Value Clear
Waveform Charts? in the Related Links section below.
Waveform Chart:
1.
2.
3.
This writes an empty array of data to the chart, which will clear the history when this code is executed.
Waveform Graph:
To clear a graph programmatically, a Property Node or Invoke Node can be used.
Property Node:
1.
2.
3.
4.
Make sure the graph is clear by right-clicking the graph and choosing Data OperationsClear Graph.
Right-click the graph and select CreateProperty NodeValue.
Right-click Value and select Change to Write.
Right-click the Value Terminal and select Create Constant. This writes empty data to the graph
which will clear the graph when this code is executed.
Invoke Node:
1.
2.
Make sure the graph is clear by right-clicking the graph and selecting Data OperationsClear Graph.
Right-click the graph and select CreateInvoke NodeReinitialize to Default.
In LabVIEW releases prior to 8.0, you cannot create a constant if waveform data is being written to the
chart. Instead, use one of the methods described below.
Waveform Chart and Graph (Property Node):
1.
2.
Make sure the graph is clear by right-clicking and select Data OperationsClear Graph.
Right-click the graph and select CreateInvoke NodeReinitialize to Default.
The following link shows a LabVIEW shipping example that demonstrates how to do this:
How to Clear Charts & Graphs
You can also find this example in the NI Example Finder, or in this file location:
[labview]\examples\general\graphs\charts.llb\How to Clear Charts & Graphs.vi
Related Links:
KnowledgeBase 3VGFK1HY: Why Doesn't Reinitializing to Default Value Clear Waveform Charts
Developer Zone Example: Clearing Charts and Graphs Programmatically
Example: How to Clear Charts & Graphs
Community: Clearing Charts & Graphs Programmatically