Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

WPF Graph: How to get the history of data previously written with ChartCollection?

LabVIEW support waveform chart keep the history of data previously written, the intensity chart maintains a history of data, or buffer, from previous updates. Right-click the chart and select Chart History Length from the shortcut menu to configure the buffer. The default size for an intensity chart is 128 data points. The intensity chart display can be memory intensive. When a chart runs continuously, its history grows and requires additional memory space. This continues until the chart history is full, then LabVIEW stops taking more memory. LabVIEW does not automatically clear the chart history when the VI restarts. You can clear the chart history throughout the execution of the program. To do this, write empty arrays to the History Data attribute node for the chart.

How can I use the same feature with Measurement Studio for .Net?

0 Kudos
Message 2 of 3
(3,491 Views)
How to get the history of data previously written with ChartCollection?

You can use the indexer to access specific history values, or enumerate like any other .NET collection with foreach or LINQ.

 

Right-click the chart and select Chart History Length from the shortcut menu to configure the buffer. The default size for an intensity chart is 128 data points.

The equivalent type for the Measurement Studio WPF chart collection is the Capacity property. The constructor you are using (new ChartCollection<double>(100)) is initializing Capacity to 100. The default capacity for charts is 1024.

 

When a chart runs continuously, its history grows and requires additional memory space. This continues until the chart history is full, then LabVIEW stops taking more memory.

When you create a ChartCollection, it allocates the specified capacity up-front, and does not require additional memory as values are appended (unless Capacity is increased). As you append values, the chart collection will re-use that allocated memory (overwriting old values as new ones are appended beyond Capacity).

 

LabVIEW does not automatically clear the chart history when the VI restarts. You can clear the chart history throughout the execution of the program. To do this, write empty arrays to the History Data attribute node for the chart.

You can use the Clear method to reset the chart collection history.

 

You may also be interested in the How to: Plot and Chart topic for information on how to send data to the WPF graph controls.

~ Paul H
0 Kudos
Message 3 of 3
(3,396 Views)