Example: CWBinding Reader

Measurement Studio User Interface

Example: CWBinding Reader

Demonstrates how to display data from different external data sources in a graph using integrated DataSocket connectivity configured in the property pages and one line of code.

Description

The Graph contains one CWBinding object that connects to the source selected on the user interface in ReadAutoUpdate mode, so the graph displays new data when ever the source has new data available. The external data source is bound to the CWGraph.YData property. Setting the YData property is the same as calling the PlotY method to plot new data points. You can plot xy data by binding the XYData property or chart data by binding the YDataAppend or XYDataAppend property.

This example can connect to the following data sources:

A simple wave file on the National Instruments Web server:

http://www.natinst.com/cworks/datasocket/chirp.wav

A waveform in DSD format on the National Instruments FTP server:

ftp://ftp.natinst.com/support/compworks/datasocket/chirp.dsd

A more complex waveform on the National Instruments Web server:

http://www.natinst.com/cworks/datasocket/schirp.dsd

Data from a tabbed text file on the FTP server:

ftp://ftp.natinst.com/support/compworks/datasocket/tabtext.txt

Data from the local DataSocket server. To use this data source, you must start a DataSocket server on your computer and run the DSWriter example from the Samples/DataSocket directory.

dstp://localhost/wave

This example also displays the connection status using the CWBindingStatusUpdated event.

Controls, Properties, Methods, and Events

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

CWBinding

ConnectTo, Disconnect

CWGraph

Example Location

Samples\UI\Common\CWBinding

See Also

Simple CWBinding Example

CWBinding Features Example