Skip to content

Commit

Permalink
Allow individual chart controllers to opt-in to the decimation plugin (
Browse files Browse the repository at this point in the history
…#10182)

* Allow individual chart controllers to opt-in to the decimation plugin

* Code review feedback
  • Loading branch information
etimberg committed Feb 21, 2022
1 parent 16e6acc commit d3a9bf3
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/controllers/controller.line.js
Expand Up @@ -7,6 +7,7 @@ export default class LineController extends DatasetController {

initialize() {
this.enableOptionSharing = true;
this.supportsDecimation = true;
super.initialize();
}

Expand Down
1 change: 1 addition & 0 deletions src/core/core.datasetController.js
Expand Up @@ -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 = [];

Expand Down
2 changes: 1 addition & 1 deletion src/plugins/plugin.decimation.js
Expand Up @@ -217,7 +217,7 @@ export default {
return;
}

if (meta.type !== 'line') {
if (!meta.controller.supportsDecimation) {
// Only line datasets are supported
return;
}
Expand Down
4 changes: 4 additions & 0 deletions types/index.esm.d.ts
Expand Up @@ -578,6 +578,10 @@ export class DatasetController<
readonly index: number;
readonly _cachedMeta: ChartMeta<TElement, TDatasetElement, TType>;
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[];
Expand Down

0 comments on commit d3a9bf3

Please sign in to comment.