# Programming with Strip Chart Controls

Use strip chart controls to display graphical data consisting of one or more traces that are updated simultaneously. The following topic describes how to program with strip chart controls.

## Traces

You can configure a strip chart control to contain a given number of traces using SetCtrlAttribute with the ATTR_NUM_TRACES attribute. When you use the PlotStripChart function to add data to the strip chart, the data points you pass to PlotStripChart are evenly appended to each trace in the strip chart.

PlotStripChart behaves like SetCtrlVal in that if the strip chart is visible, drawing takes place immediately, without the need to process events.

ClearStripChart removes all data from the strip chart.

You can customize individual traces by setting attributes on a given trace using SetTraceAttribute and GetTraceAttribute. Refer to traces through their one-based index.

## Axes

GetAxisScalingMode obtains the current range of the y-axis of a strip chart control. SetAxisScalingMode sets the current range of the y-axis of a strip chart. GetAxisScalingMode and SetAxisScalingMode are not valid for the x-axis of a strip chart. To obtain the x offset and x increment for a strip chart, use GetCtrlAttribute with the ATTR_XAXIS_OFFSET and ATTR_XAXIS_GAIN attributes. To set the x offset and x increment for a strip chart, use SetCtrlAttribute with the ATTR_XAXIS_OFFSET and ATTR_XAXIS_GAIN attributes.

You cannot set the minimum or maximum value for a strip chart x-axis.

## Axis Strings

You can replace the numeric labels of strip chart axes with custom text strings. When you enable the ATTR_XUSE_LABEL_STRINGS or ATTR_YUSE_LABEL_STRINGS attribute, the strip chart displays text strings at given axis locations, instead of the default numeric labels. Specify these strings in the form of label/value pairs, in the Edit Strip Chart dialog box or programmatically using InsertAxisItem.

Use functions such as GetAxisItem, ReplaceAxisItem, and DeleteAxisItem to manipulate these label/value pairs.

Each individual string appears only when the value it is associated with falls within the range of the axis.

## Specifying Dates and Times for Axis Values

Use the ATTR_XFORMAT and ATTR_YFORMAT attributes to specify the display format of the x-axis and y-axis values. To display date/time data, set the display format to VAL_RELATIVE_TIME_FORMAT or VAL_ABSOLUTE_TIME_FORMAT.

If you use the absolute time format, LabWindows/CVI expects that you plot data that contains the number of seconds since January 1, 1900. This format is compatible with the format the time and GetCurrentDateTime functions use. If you use the relative time format, LabWindows/CVI expects that you plot data that contains the number of seconds since some arbitrary point in time, commonly denoted as t0. For example, you might use the start of a data acquisition process as the arbitrary point in time.

You can call SetAxisTimeFormat to change the format string that specifies how the date/time is displayed on the specified axis. The format string can contain the specifiers that the ANSI C strftime function supports. You also can use an additional specifier, %nf, which represents the fractional part of the seconds, and the @ modifier, which restricts overflow for certain time units.

When the axes are in absolute time or relative time format, the value you specify for ATTR_XAXIS_OFFSET or ATTR_YAXIS_OFFSET is the t0 value. The value you specify for ATTR_XAXIS_GAIN or ATTR_YAXIS_GAIN is the Δt value. Call MakeDateTime or GetCurrentDateTime to obtain time values you can use as ATTR_XAXIS_OFFSET and ATTR_YAXIS_OFFSET values. You also can pass time values to the SetAxisScalingMode min and max parameters when you configure an axis for manual scaling.

## Anti-Aliasing

Anti-aliasing causes plots to draw more smoothly, but the plotting speed is significantly slower. By default, strip charts do not draw anti-aliased plots. To enable anti-aliasing, use the following function:

SetCtrlAttribute (panelHandle, controlID, ATTR_ANTI_ALIASED_PLOTS, 1);

## Data Binding

Linux Data binding is not supported on Linux.

You can bind strip chart controls to a DataSocket source. Controls can have only one DataSocket connection. You must specify whether the access mode is READ mode or WRITE mode:

- READ mode—The control gets data from the DataSocket source. In strip chart controls, the new data is appended to the existing traces. In READ mode, the value of the strip chart control is updated automatically when the value changes at the source.
- WRITE mode—The control transfers data to the DataSocket source. In WRITE mode, the value at the DataSocket source is updated automatically when the value of the strip chart control changes.

Use DSBindCtrl DSBindCtrl to bind a strip chart control to a DataSocket source. Data is sent to and received from the DataSocket source as a 1D array of data that is split among the traces on the chart. Use DSUnbind DSUnbind to disconnect the strip chart control from the DataSocket source.

The data type of the control must match the data type in the DataSocket source.

You must enable the DataSocket option in the Edit Installer dialog box Drivers & Components Drivers & Components tab if your applications use data binding.