dataPrepareSettings

An object providing options 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 dxRangeSelector's chart. To resolve this situation, use the options provided by the dataPrepareSettings configuration object. You can enable/disable data validation using the checkTypeForAllData option, or specify whether or not to convert the data source values to the type of the axis using the convertToAxisDataType option. In addition, you can sort the series points using the sortingMethod option.

Show Example:
jQuery

In this example, the data source has values of different types. These value types are checked and converted into the axis type as the checkTypeForAllData and convertToAxisDataType options are set to true. In addition, the series points are sorted in descending order by values using the function assigned to the sortingMethod option.


                                    

                                    

checkTypeForAllData

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

Type: Boolean
Default Value: false

Use this option 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 option 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 option 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 option 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 option 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 option to true in order to prevent the chart from behaving incorrectly. However, since conversion between types affects performance, it is useful to set this option 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(a,b)
Function parameters:
a: Object
A series point.
Object structure:
The argument of this series point.
The value of this series point.
b: Object
A series point.
Object structure:
The argument of this series point.
The value of this series point.
Return Value: Number
Indicates whether a comes before b.
Default Value: true

This option specifies the sorting manner of series points. When this option is set to true, the series points are sorted in ascending order by arguments. When this option 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.