Skip to main content
Version: 7.1.2

Data cleaning

With the new XY features, automatic data cleaning is configured a little bit differently. Previously, you'd most often do this:

SeriesXY.setDataCleaning({ minDataPointCount: 1 })

Now, data cleaning is configured by specifying the maximum number of samples that are kept around at any point:

// Keep no more than 1 million samples in memory
PointLineAreaSeries.setMaxSampleCount(1_000_000)

Compared to previous implementations of data cleaning, this operation is completely predictable. The above would result in memory being allocated for exactly 1 million samples, no more, no less.

All real-time use cases (where data points are pushed in periodically) must define a "max sample count"!

This allocates the required amount of memory beforehand, which is crucial to get the best performance. After 1 million samples are reached, the oldest samples will start dropping out.

Alternatively, if you are uncertain what value to use and don't want to allocate too much memory up-front, you can start small and automatically increase the buffer size as samples flow in:

PointLineAreaSeries.setMaxSampleCount({ mode: 'auto', max: 10_000_000 })

This would first allocate only small amount of memory, progressively increase memory allocation as samples come in until eventually limiting sample count to 10 million.

If you forget to do this, there is a console warning which will remind you.