From: Evert Timberg Date: Wed, 1 Jun 2016 02:28:22 +0000 (-0400) Subject: Docs on new plugin callback X-Git-Tag: v2.1.5~20^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b96fdcaf857f433fe2ebe4a39448a002dc507e68;p=thirdparty%2FChart.js.git Docs on new plugin callback --- diff --git a/docs/09-Advanced.md b/docs/09-Advanced.md index ff2810f85..2641856c5 100644 --- a/docs/09-Advanced.md +++ b/docs/09-Advanced.md @@ -399,7 +399,10 @@ Plugins should derive from Chart.PluginBase and implement the following interfac // Easing is for animation beforeDraw: function(chartInstance, easing) { }, - afterDraw: function(chartInstance, easing) { } + afterDraw: function(chartInstance, easing) { }, + // Before the datasets are drawn but after scales are drawn + beforeDatasetDraw: function(chartInstance, easing) { }, + afterDatasetDraw: function(chartInstance, easing) { }, destroy: function(chartInstance) { } } diff --git a/src/core/core.controller.js b/src/core/core.controller.js index cc564b65a..195475514 100644 --- a/src/core/core.controller.js +++ b/src/core/core.controller.js @@ -288,7 +288,7 @@ module.exports = function(Chart) { this.scale.draw(); } - Chart.pluginService.notifyPlugins('beforeElementDraw', [this, easingDecimal]); + Chart.pluginService.notifyPlugins('beforeDatasetDraw', [this, easingDecimal]); // Draw each dataset via its respective controller (reversed to support proper line stacking) helpers.each(this.data.datasets, function(dataset, datasetIndex) { @@ -302,7 +302,7 @@ module.exports = function(Chart) { // Finally draw the tooltip this.tooltip.transition(easingDecimal).draw(); - Chart.pluginService.notifyPlugins('afterDraw', [this, easingDecimal]); + Chart.pluginService.notifyPlugins('afterDatasetDraw', [this, easingDecimal]); }, // Get the single element that was clicked on