5.1.7 Data Validator

AbstractChartSeries contains DataModelValidator, which can be retrieved by getModelValidator() method.

This validator validates stacked data model consistency, also if set, sorts data in the data model according to the axes.

Enabling sorting:

 
series.getModelValidator().setSortEnabled(true);
series.getModelValidator().setSortDirection(SortDirection.DESCENDING);

It is possible to set the key data type, which would be used to sort the data. If not set, then automatically determined key data value type is used.

 
series.getModelValidator().setKeyType(DataValueType.KEY);

Here is the stack consistency enabling example:

 
series.getModelValidator().setValidationEnabled(true);

Additionally by default data type validation for all data columns is enabled. Just to check if the data are of the same type in the data column. If there is a need to disable this feature (in large data sets it can be time consuming), this code should be used to disable this feature:

 
series.getModelValidator().setValidateTypes(false);