React RangeSelector - chart.dataPrepareSettings
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 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.
checkTypeForAllData
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
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
Name | Type | Description |
---|---|---|
arg | | | |
The series point's argument. |
val | | | |
The series point's value. |
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.
If you have technical questions, please create a support ticket in the DevExpress Support Center.