SetData Method (AChart)

Plots the specified Y data against the specified X data for one or all Plot objects on the object.

Syntax

[ bStatus = ] Object.SetData ( [ vPlot, ] vDataY [, vDataX ] [, dStartX ] [, dIncX ] [, bClearData ] [,vaShmooStates] )

The SetData method syntax has the following parts:

 

Name

Type

Description

Object

AChart

AChart control

bStatus

Bool

Returns True if the plot succeeded, False is an error occurred.

vPlot

Val Variant

Either the name of the plot object or the zero-based index of the object in the array.

vDataY

Val Variant

An array of Y axis data or a single value.

vDataX

Val Variant

An array of X axis data or a single value.

dStartX

Val Variant

The start of an array of X axis data.

dIncX

Val Variant

The increment of the X axis data.

bClearData

Val Variant

A boolean expression that specifies whether the previous data is to be cleared before plotting.

vaShmooStates (v9)

Val Variant

Single or array values of Bool, True for Pass (green) and False for fail (red).

Where

bClearData can be one of the following, False being its default value:

 

Value

Description

True

The previous data is to be cleared before plotting.

False *

The previous data is not to be cleared before plotting.

Comments

Plots a one-dimensional array of Y data against a one-dimensional array of X data or against its index in the array, or against another linear set of X values specified by dStartX and dIncX.

The most common failure comes from invalid data, for example, there are not enough X-axis points to match the number of Y-axis points.

vDataY and vDataX must be plottable values or an error will occur.

If there is no vDataX, then dStartX and dIncX will be used. For example, is dStartX is 10 and dIncX is 7, then the x values will be 10, 17, 24, etc. A common example is time values, where dStartX is one second and dIncX is one second intervals.

The type of vDataX needed depends on the style of the plot, which in turn is set by the Style property of the AChart object. If the style of the plot does not use x values, for example, a vertical bar chart or a logic chart, then no x values are needed. In those cases, separate plots are used for the x values.

Example

The following example will plot a set of data, clearing the old data beforehand, starting at the first X and Y point in the cht1Y array and cht1X array:

chtXY.SetData(0,aDataY,aDataX,0,0,True)

The following example will make a vertical bar chart of values for Test1 and Test2:

chtSamples.Style=achtStyleVerBar ! Set a vertical bar chart style

bStatus = chtSamples.SetData ("Test1", 10822.10, , , TRUE)

bStatus = chtSamples.SetData ("Test2", 4581.39, , , TRUE)

If the Test1 and Test2 values were in an array, then only one SetData is needed:

chtSamples.Style=achtStyleVerBar ! Set a vertical bar chart style

adSampling={10822.10,4581.39}

bStatus=chtSamples.SetData( , adSampling, , , TRUE)

Applies to

AChart

See Also

AAxis, APlot, Axes, Plots