What is Data Resampling and how does it work?
By default, SciChart uses resampling (culling) of data to ensure the minimum viable data-set is displayed on the screen. Resampling is intended to be lossless, and automatic. It occurs for every RenderableSeries before the series is rendered, if required.
Resampling methods make assumptions about the data in order to produce a valid output. SciChart provides variety of the ResamplingMode, and auto detects the most suitable one.
However, there are cases when data input cannot be resampled accurately. Good examples could be plotting unsorted data or using logarithmic scale on an axis. We recommend using None in such situations, which in other word means switching Resampling off.
Note
Please be aware that if you disable resampling you will experience a degradation in performance.
Resampling Modes
There are several ResamplingMode available in SciChart:
Resampling Modes | Description |
---|---|
None | switches off Resampling on a IRenderableSeries. |
MinMax | suitable for evenly-spaced data. Resamples by taking the min-max of oversampled data. |
Min | suitable for evenly-spaced data. Resamples by taking the minimum point of oversampled data. |
Max | suitable for evenly-spaced data. Resamples by taking the maximum point of oversampled data. |
Mid | suitable for evenly-spaced data. Resamples by taking the median point of oversampled data. |
Auto | This is the default mode. It auto-detects the most suitable resampling algorithm - fastest and most accurate - for the type of data appended. |
Cluster2D | Groups close points in 2D space |
MinMaxWithUnevenSpacing | not suitable for evenly-spaced data. Resamples by taking the min-max of oversampled data. |
Setting Resampling Mode
Most of the time, you don't need to set ResamplingMode manually. SciChart auto detects the best one for a given data and uses it internally. However, when it is necessary, the ResamplingMode can be set explicitly via the resamplingMode property:
// Create a DataSeries with unsorted data
final IXyDataSeries<Double, Double> unsortedDataSeries = new XyDataSeries<>(Double.class, Double.class);
unsortedDataSeries.setAcceptsUnsortedData(true);
final FastLineRenderableSeries rSeries = new FastLineRenderableSeries();
// Set a DataSeries with unsorted data
rSeries.setDataSeries(unsortedDataSeries);
// Switch off Resampling because the DataSeries is unsorted
rSeries.setResamplingMode(ResamplingMode.None);
Resampling Performance
Resampling makes drawing many millions of points possible with SciChart. For instance, in the Performance Demo example, we push 1000 points every 10ms to three series on a chart. The point count quickly rises to the millions of points, and SciChart is still rendering at interactive rates. Also, the example allows to play around with different ResamplingMode and see their impact on performance.
In addition, we compared performance of the most popular Android charting packages with SciChart. The results can be found in the Performance Comparison article.