diff --git a/src/controllers/controller.line.js b/src/controllers/controller.line.js index a62d9be895a..be96e72ed79 100644 --- a/src/controllers/controller.line.js +++ b/src/controllers/controller.line.js @@ -7,6 +7,7 @@ export default class LineController extends DatasetController { initialize() { this.enableOptionSharing = true; + this.supportsDecimation = true; super.initialize(); } diff --git a/src/core/core.datasetController.js b/src/core/core.datasetController.js index b6c6778d999..85cc50e9162 100644 --- a/src/core/core.datasetController.js +++ b/src/core/core.datasetController.js @@ -237,6 +237,7 @@ export default class DatasetController { this._drawStart = undefined; this._drawCount = undefined; this.enableOptionSharing = false; + this.supportsDecimation = false; this.$context = undefined; this._syncList = []; 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[];