From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.



如何在LabVIEW中编程清除一个图形(Chart)的数据



主要软件: LabVIEW Development Systems>>LabVIEW Base Development System
主要软件版本: 7.0
主要软件修正版本: N/A
次要软件: N/A

问题:
在我的LabVIEW前面板有个Chart,但我只发现清除数据的方法是右键点击chart,并从快捷菜单中选择Data Operations » Clear Chart。有没有通过编程的方法清除数据的?

解答:
通过编程的方法清除数据,您可以使用属性节点。
  1. 右键点击chart,并选择Create » Property Node
  2. 右键点击属性并选择Properties » History Data
  3. 右键点击属性并选择Change to Write
  4. 右键点击属性并选择Create Constant
这将写一个空数组数据给chart,这将在代码执行的时候清除历史数据。

在LabVIEW 8.0发布前,如果波形数据已经写入Chart,则您将不能创建一个常数。相反的:
  1. 右键点击属性并选择Create » Control.
  2. 切换到前面板,右键点击新创建的控键。选择 Advanced » Hide Control。
在LabVIEW有个例子说明这个功能,叫作How to Clear Charts & Graphs.vi。下面同样有Developer Zone例子程序的链接。

您同样可以使用这个方法初始化chart。您创建的常数组可作为初始数据。一个数组控键同样可以连给属性节点。

相关链接:
Developer Zone Example: Programmatically Clearing Charts and Graphs in LabVIEW

附件:





报告日期: 08/03/2006
最近更新: 12/11/2007
文档编号: 0HLH3PTA