diff --git a/src/controllers/controller.line.js b/src/controllers/controller.line.js index a62d9be895a..e610ffa4b06 100644 --- a/src/controllers/controller.line.js +++ b/src/controllers/controller.line.js @@ -6,8 +6,9 @@ import {_lookupByKey} from '../helpers/helpers.collection'; export default class LineController extends DatasetController { initialize() { - this.enableOptionSharing = true; super.initialize(); + this.enableOptionSharing = true; + this.supportsDecimation = true; } update(mode) { diff --git a/src/core/core.datasetController.js b/src/core/core.datasetController.js index b6c6778d999..7c3fd3b1881 100644 --- a/src/core/core.datasetController.js +++ b/src/core/core.datasetController.js @@ -249,6 +249,7 @@ export default class DatasetController { this.linkScales(); meta._stacked = isStacked(meta.vScale, meta); this.addElements(); + this.supportsDecimation = false } updateIndex(datasetIndex) { diff --git a/src/plugins/plugin.decimation.js b/src/plugins/plugin.decimation.js index 20fbb44b93a..95604e42966 100644 --- a/src/plugins/plugin.decimation.js +++ b/src/plugins/plugin.decimation.js @@ -217,7 +217,7 @@ export default { return; } - if (meta.type !== 'line') { + if (!meta.controller.supportsDecimation) { // Only line datasets are supported return; } diff --git a/types/index.esm.d.ts b/types/index.esm.d.ts index a4f463c25b1..efa73a793ed 100644 --- a/types/index.esm.d.ts +++ b/types/index.esm.d.ts @@ -576,6 +576,10 @@ export class DatasetController< readonly index: number; readonly _cachedMeta: ChartMeta; enableOptionSharing: boolean; + // If true, the controller supports the decimation + // plugin. Defaults to `false` for all controllers + // except the LineController + supportsDecimation: boolean; linkScales(): void; getAllParsedValues(scale: Scale): number[];