SciChart WPF 2D Charts > DataSeries API > DataSeries DataDistributionCalculator
DataSeries DataDistributionCalculator

DataDistributionCalculator

The DataSeries.DataDistributionCalculator is a class which determines the distribution of your data (sorted in X or not, evenly spaced in X or not) and the flags are used to determine the correct algorithm(s) for resampling, hit-testing and indexing of data.

By default this all works automatically, however, if you want to save a few CPU cycles and you know in advance the distribution of your data, you can override the flags as follows:

DataDistributionCalculator
Copy Code
var xyDataSeries = new XyDataSeries<double, double>()
{
    // use this feature to override Data-distribution calculation and
    // provide your own flags to save CPU cycles. Only use if you are certain about the
    // distribution of your data
    DataDistributionCalculator = new UserDefinedDistributionCalculator<double>()
    {
        IsSortedAscending = true,
        IsEvenlySpaced = true,
    }
};

DataSeries.AcceptsUnsortedData

By default, DataSeries are designed to throw an exception if data is appended unsorted in X. This is because unsorted data is detrimental to performance, and many people were unintentionally appending data unsorted in the X-direction.

To enable unsorted data and prevent the exception, set the DataSeries.AcceptsUnsortedData flag.

DataSeries.AcceptsUnsortedData
Copy Code
var xyDataSeries = new XyDataSeries<double, double>()
{
    AcceptsUnsortedData = true
};