React PolarChart - 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 a 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

Specifies whether or not to validate the 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 to 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 the series points.

Type:

Boolean

|

Function

Function parameters:
a:

Object

A series point.

Object structure:
Name Type Description
arg

Date

|

Number

|

String

The argument of this series point.

val

Date

|

Number

|

String

The value of this series point.

b:

Object

A series point.

Object structure:
Name Type Description
arg

Date

|

Number

|

String

The argument of this series point.

val

Date

|

Number

|

String

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

NOTE
When the argumentType is 'string', the sortingMethod option does not accept Boolean values. However, you can still apply sorting using a function. In addition, you can use categories to perform the same task.