Example: Visualizing Data

Measurement Studio User Interface

Example: Visualizing Data

Demonstrates basic graph features and behavior, including how to work with the CWGraph control interactively in the Measurement Studio property pages and programmatically using Visual Basic code, charting real-time and historical data, plotting acquired signals, and customizing the CWGraph control to look exactly the way you want it to look.

Description

Choose one of the following options and press the Display Data button:

The Plot option uses the PlotY method on the CWGraph object to display a signal. Press the Display Data button several times to see how each call to the PlotY method plots a new signal.

The Chart option uses the ChartXY method on the CWGraph object to append a new signal to existing charts. In this case, the chart history is set to hold 3000 measurements, so pressing on the Display Data button several times appends new data to the chart and removes the oldest data to maintain a total measurement count of 3000 data points in the chart.

The Multiple plots option uses the PlotY method to create multiple plots at the same time by using a two-dimensional array of data. Each row of the array creates a plot in the graph.

The Compute average option creates multiple plots, then uses the Mean method on the CWStat1 control to compute the mean of the four plots and graph the result in a fifth plot. This option also sets the Multiplot property of the fifth plot to False so it is not replaced (or removed) when new plots are added to the graph. Click on the Multiple plots option again to see how the four original plots are replaced, but the fifth plot (average) remains untouched.

The Customize option demonstrates how you can use the properties of the CWGraph, CWPlot, and CWAxis objects to create a graph that looks exactly like you want. Here the graph has two y-axes, axes titles, and a graph title.

These options and the properties and methods that were used to create this example are fully explained in Application Note 150, Visualizing Data in Visual Basic.

Controls, Properties, Methods, and Events

This example demonstrates the following controls, properties, methods, and events:

CWGraph

Axes, Plots, Caption, ChartLength, PlotY, ChartXY

CWPlot

LineColor, MultiPlot, Name, PlotY, YAxis

CWAxis

AutoScale, Caption, Name, Labels, Ticks, ValuePairs, AutoScaleNow, SetMinMax

CWValuePair

Name, Value

Example Location

Samples\UI\Graph\_Getting Started