Example: Simple Annotations

Measurement Studio User Interface

Example: Simple Annotations

Demonstrates basic uses of annotations on a Measurement Studio Graph (CWGraph) control.

Description

This example demonstrates how to programmatically create annotations to highlight data on a graph. In this example, a point-style annotation marks the minimum and maximum plot values of randomly generated data. To change the data, use the knob control to scale the data, then click the Get Data button to acquire and plot the data.

This example also demonstrates user interaction with annotations at run time. To reposition the annotation captions and lines, drag them with your mouse. Since the CWAnnotation.SnapMode property is set to cwCSnapAnchoredToPoint, you cannot move the annotation point. You can move the annotation captions and lines because the CWGraph.TrackMode property is set to cwGTrackDragAnnotation, and the Enabled property for both annotations is set to True.

Controls, Properties, Methods, and Events

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

CWGraph

PlotY

CWAnnotation

Enabled, Name, Plot, PointIndex, SnapMode

CWCaption

SetCoordinates, Text

CWShape

Type

CWKnob

CWPointer

Value

Example Location

Samples\UI\Graph\Annotations