Chart.js/docs/configuration/decimation.md
Evert Timberg ed2b96eeaf
Switch docs to Vuepress to match other chart.js repositories (#8751)
* Initial work

* Update doc commands

* Updated sidebar config

* Move docs

* Update theme version and enable

* Convert to chart.js sample

* Update scripts to point to local build

* Chart.js from local build

* Simplify getting-started example

* Axis docs updated except for imported content

* Common ticks import works

* Chart type docs ported to editor plugin

* Last pages to use editor

* Fix small errors

* Frontmatter title to heading

* Remove duplicate example

* Update sidebar

* Add paths

* Remove paths

* Add getting-started back

* Update menus and add copyright to license section of the docs

* Add GA plugin

* Style sub-groups

* Remove unneeded license page since it is covered on the main page

* Remove docusaurus readme page

* Remove docusaurus files

* Fix issues in docs

* Build and deploy scripts for docs work

* Conditional base URL for nice local testing

* Use eslint-plugin-markdown

* Remove hard coded lines

* Remove mentions of docusaurus

Co-authored-by: Jukka Kurkela <jukka.kurkela@gmail.com>
2021-03-30 10:32:39 -04:00

1.9 KiB

Data Decimation

The decimation plugin can be used with line charts to automatically decimate data at the start of the chart lifecycle. Before enabling this plugin, review the requirements to ensure that it will work with the chart you want to create.

Configuration Options

Namespace: options.plugins.decimation, the global options for the plugin are defined in Chart.defaults.plugins.decimation.

Name Type Default Description
enabled boolean true Is decimation enabled?
algorithm string 'min-max' Decimation algorithm to use. See the more...
samples number If the 'lttb' algorithm is used, this is the number of samples in the output dataset. Defaults to the canvas width to pick 1 sample per pixel.

Decimation Algorithms

Decimation algorithm to use for data. Options are:

  • 'lttb'
  • 'min-max'

Largest Triangle Three Bucket (LTTB) Decimation

LTTB decimation reduces the number of data points significantly. This is most useful for showing trends in data using only a few data points.

Min/Max Decimation

Min/max decimation 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.

Requirements

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

  1. The dataset must have an indexAxis of 'x'
  2. The dataset must be a line
  3. The X axis for the dataset must be either a 'linear' or 'time' type axis
  4. The dataset object must be mutable. The plugin stores the original data as dataset._data and then defines a new data property on the dataset.