Skip to main content
Version: 5.5

Decimation

The decimation element can be used with line charts to automatically decimate data at the start of the chart life cycle.

Before enabling it, review the requirements to ensure that it will work with the chart you want to create.

The decimation configuration is nested in the chart configuration as following:

// sets the sample at chart level
chart.getOptions().getDecimation().setSamples(1000);

double samples = Dchart.getOptions().getDecimation().getSamples();

The defaults values are set in global defaults options, see default global decimation options.

The following are the attributes that you can set:

NameTypeDescription
enabledbooleanIf true, the data decimation is enabled.
algorithmDecimationAlgorithmDecimation algorithm to use.
samplesdoubleIf the DecimationAlgorithm.LTTB is used, this is the number of samples in the output dataset. Defaults to the canvas width to pick 1 sample per pixel.
thresholddoubleIf the number of samples in the current axis range is above this value, the decimation will be triggered.
Defaults to 4 times the canvas width.
The number of point after decimation can be higher than the threshold value.

Algorithms

The available decimation algorithms to use for data are the following:

  • DecimationAlgorithm.MIN_MAX: it will preserve peaks in your data but could require up to 4 points for each pixel. This type of decimation would work well for a very noisy signal where you need to see data peaks.
  • DecimationAlgorithm.LTTB (Largest Triangle Three Bucket): it reduces the number of data points significantly. This is most useful for showing trends in data using only a few data points.

Requirements

To use the decimation, the following requirements must be met:

  1. The dataset must have an IndexAxis of IndexAxis.X.
  2. The dataset must be a line.
  3. The dataset must not need any parsing for instance having parsing option set to false.
  4. The X axis for the dataset must be either a linear or time axis.

Filler

Filler element configures the engine which is in charge to manage the filling of the datasets, by the property fill. See here how filling a dataset.

The filler configuration is nested in the chart configuration as following:

// disables the propagation at chart level
Dchart.getOptions().getFiller().setPropagate(false);

boolean propagate = chart.getOptions().getFiller().isPropagate();

The defaults values are set in global defaults options, see default global filler options.

The following are the attributes that you can set:

NameTypeDescription
propagatebooleanIf true, the fill area will be recursively extended to the visible target defined by the fill value of hidden data set targets.
drawTimeDrawTimeFiller draw time.