ChartDirector 7.0 (Perl Edition)

Layer.getXIndexOf


Usage

getXIndexOf(xValue [, tolerance ])

Description

Gets the data point index at the specified x data value.

The index can be used in DataSet.getValue and DataSet.getPosition to obtain the y values and positions of the data points for all data sets in the layer.

The tolerance argument is to allow this method to consider data points that are not exactly at xValue, but are within tolerance from it.

If multiple data points at within tolerance, this method will return the index of the data point nearest to xValue. If multiple data points are equally near to xValue, this method will choose one arbitrarily and return its data point index. If no data points are found, this method will return -1.

Arguments

ArgumentDefaultDescription
xValue(Mandatory)The x data value used to look for the data points in order to get the data point index of the nearest data point.
tolerance0The tolerance allowed for for data points that are not exactly at the specified xValue.

Return Value

The data point index of the data point nearest to the specified x data value up to the specified tolerance, or -1 if no data points are found.