ChartDirector 6.0 (Perl Edition)

Layer.setXData


Usage

setXData(xData)

Description

Sets the x values of the data points in the data sets.

In most ChartDirector XY chart layers, when a data set is added, only the y Values for the data points are needed. For example, in a bar layer, you just need to specify the values of the bars (y values). ChartDirector will automatically layout the bars evenly on the x-axis. You can then specify the labels on the x-axis using Axis.setLabels.

In ChartDirector, this type of x-axis scaling is called "enumerated" scale. Please refer to Axis.setLabels for a more detail explanation of "enumerated" scale.

However, in some cases, it may be necessary to specify the x values explicitly. For example, if a chart contains data points that are not evenly distributed on the x-axis, it is necessary to specify the x values explicitly. It is because enumerated scale always assume the data points are distributed evenly on the x- axis. In this case, the setXData method can be used to specify the x values for the data points.

In general, if the data points are evenly distributed on the x-axis, it is recommended enumerated x-scale be used and no x values are necessary. Even the data points are evenly distributed, except that some data points are missing, it is still possible to use enumerated x-scale by using the NoValue constant to represent missing data points.

On the other hand, if the data points are by its nature not evenly distributed, the x values should be provided explicitly using the setXData method.

Each layer only supports one x values series. All data sets in the layer will use the same x value series. If two data sets have different x values, they should be put in two separate layers.

Arguments

ArgumentDefaultDescription
xData(Mandatory)An array of numbers representing the x value series.

Return Value

None