From 18c003959d811da1edaff34c63c1eaa3922d1733 Mon Sep 17 00:00:00 2001 From: Jukka Kurkela Date: Thu, 3 Sep 2020 18:45:57 +0300 Subject: [PATCH] Chart.register instead of Chart.plugins.register (#7753) --- docs/docs/developers/plugins.md | 6 +++--- docs/docs/getting-started/v3-migration.md | 1 + samples/charts/area/analyser.js | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/docs/docs/developers/plugins.md b/docs/docs/developers/plugins.md index 19bda89d1..0e4bb3316 100644 --- a/docs/docs/developers/plugins.md +++ b/docs/docs/developers/plugins.md @@ -43,7 +43,7 @@ However, this approach is not ideal when the customization needs to apply to man Plugins can be registered globally to be applied on all charts (a.k.a. *global plugins*): ```javascript -Chart.plugins.register({ +Chart.register({ // plugin implementation }); ``` @@ -92,7 +92,7 @@ var chart = new Chart(ctx, { To disable a global plugin for a specific chart instance, the plugin options must be set to `false`: ```javascript -Chart.plugins.register({ +Chart.register({ id: 'p1', // ... }); @@ -106,6 +106,6 @@ var chart = new Chart(ctx, { }); ``` - ## Plugin Core API +## Plugin Core API Read more about the [existing plugin extension hooks](../jsdoc/IPlugin.html). diff --git a/docs/docs/getting-started/v3-migration.md b/docs/docs/getting-started/v3-migration.md index 15ffddc0a..7cb461098 100644 --- a/docs/docs/getting-started/v3-migration.md +++ b/docs/docs/getting-started/v3-migration.md @@ -263,6 +263,7 @@ The following properties and methods were removed: * `Chart.offsetY` * `Chart.outerRadius` now lives on doughnut, pie, and polarArea controllers * `Chart.plugins` was replaced with `Chart.registry`. Plugin defaults are now in `Chart.defaults.plugins[id]`. +* `Chart.plugins.register` was replaced by `Chart.register`. * `Chart.PolarArea`. New charts are created via `new Chart` and providing the appropriate `type` parameter * `Chart.prototype.generateLegend` * `Chart.platform`. It only contained `disableCSSInjection`. CSS is never injected in v3. diff --git a/samples/charts/area/analyser.js b/samples/charts/area/analyser.js index b2db9ab52..5c1005418 100644 --- a/samples/charts/area/analyser.js +++ b/samples/charts/area/analyser.js @@ -1,7 +1,7 @@ 'use strict'; (function() { - Chart.plugins.register({ + Chart.register({ id: 'samples-filler-analyser', beforeInit: function(chart, options) { -- 2.47.2