A newer version of this page is available. Switch to the current version.

JavaScript/jQuery RangeSelector - chart.dataPrepareSettings

An object providing properties for managing data from a data source.

Type:

Object

When values from a data source are of a different type, they may be displayed incorrectly on the RangeSelector's chart. To resolve this situation, use the properties provided by the dataPrepareSettings configuration object. You can enable/disable data validation using the checkTypeForAllData property, or specify whether or not to convert the data source values to the type of the axis using the convertToAxisDataType property. In addition, you can sort the series points using the sortingMethod property.

checkTypeForAllData

Specifies whether or not to validate values from a data source.

Type:

Boolean

Default Value: false

Use this property when the values of your data source are of a different type and you need to display all of them on one axis.

If this property is set to true, the type of each data source value is checked, and the axis type is chosen optimally to display all of these values. Otherwise, only the type of the first data source value is checked, and the axis type is chosen according to the type of this value. In this case, the values that cannot be cast to the type of the axis will be ignored.

Since checking each value of a data source affects performance, it is useful to set this property to false when you have a vast data source with values of the same type, and this type is known beforehand.

convertToAxisDataType

Specifies whether or not to convert the values from a data source into the data type of an axis.

Type:

Boolean

Default Value: true

If this property is set to true, all data source values will be converted from their initial type into the data type of an axis. To specify the axis data type, use the argumentType or valueType property of the argumentAxis or valueAxis object respectively. If the axis data type is not specified explicitly, it will be determined automatically on the base of the first data source value.

It is recommended that you set this property to true in order to prevent the chart from behaving incorrectly. However, since conversion between types affects performance, it is useful to set this property to false when you have a vast data source with values of the same type, with this type known beforehand.

sortingMethod

Specifies how to sort series points.

Type:

Boolean

|

Function

Function parameters:
a:

Object

A series point to be compared.

Object structure:
Name Type Description
arg

Date

|

Number

|

String

The series point's argument.

val

Date

|

Number

|

String

The series point's value.

b:

Object

A series point to be compared.

Object structure:
Name Type Description
arg

Date

|

Number

|

String

The series point's argument.

val

Date

|

Number

|

String

The series point's value.

Return Value:

Number

Specifies whether a goes before b.

Default Value: true

This property specifies the sorting manner of series points. When this property is set to true, the series points are sorted in ascending order by arguments. When this property is set to false, the order of the series points does not differ from the order in the data source.

In addition, you can order the series points per your requirements by specifying a compare function. This function accepts two parameters that represent two series points and should return the value on which the order will be based. The argument and value of these series points can be accessed using the arg and val fields correspondingly.

Assume that a and b are the parameters. If the function returns a value of less than 0, a comes before b in the resulting order. If the function returns a value greater than 0, b comes before a in the resulting order. If the function returns 0, a and b remain unchanged relative to each other.