ChartDirector 6.2 (.NET Edition)

JsLayer.getXIndexOf

Usage

getXIndexOf(xValue [, tolerance ])

Description

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

The index can be used in JsDataSet.getValue and JsDataSet.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.

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

The

If multiple data points at within tolerance, this method will return the index of the data point nearest to

Arguments

Argument | Default | Description |
---|---|---|

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. |

tolerance | 0 | The 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.

© 2017 Advanced Software Engineering Limited. All rights reserved.