]> git.ipfire.org Git - thirdparty/Chart.js.git/commitdiff
Docs on new plugin callback
authorEvert Timberg <evert.timberg+github@gmail.com>
Wed, 1 Jun 2016 02:28:22 +0000 (22:28 -0400)
committerEvert Timberg <evert.timberg+github@gmail.com>
Wed, 1 Jun 2016 02:28:22 +0000 (22:28 -0400)
docs/09-Advanced.md
src/core/core.controller.js

index ff2810f85adacf6ae4da2df73c8b6d67fad15928..2641856c547e7be863f2636a6142dc9170ed2e25 100644 (file)
@@ -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) { }
 }
index cc564b65a20d6eacb5aa615c43ef756718b37bb3..1954755141f06b7d1eaca4596426a55e02114722 100644 (file)
@@ -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