From: Evert Timberg Date: Sun, 17 Apr 2016 16:02:42 +0000 (-0400) Subject: Initial plugin calls X-Git-Tag: 2.1.0~68^2~3 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=7fa4c4c1b8ae6b9e62bc9e72eb4e1cb816cc125b;p=thirdparty%2FChart.js.git Initial plugin calls --- diff --git a/src/core/core.controller.js b/src/core/core.controller.js index 64af936de..b6dad13b9 100644 --- a/src/core/core.controller.js +++ b/src/core/core.controller.js @@ -43,9 +43,8 @@ module.exports = function(Chart) { helpers.extend(Chart.Controller.prototype, { initialize: function initialize() { - - // TODO - // If BeforeInit(this) doesn't return false, proceed + // Before init plugin notification + Chart.pluginService.notifyPlugins('beforeInit', this); this.bindEvents(); @@ -60,8 +59,8 @@ module.exports = function(Chart) { this.initToolTip(); this.update(); - // TODO - // If AfterInit(this) doesn't return false, proceed + // After init plugin notification + Chart.pluginService.notifyPlugins('afterInit', this); return this; }, @@ -243,6 +242,8 @@ module.exports = function(Chart) { }, update: function update(animationDuration, lazy) { + Chart.pluginService.notifyPlugins('beforeUpdate', this); + // In case the entire data object changed this.tooltip._data = this.data; @@ -266,6 +267,8 @@ module.exports = function(Chart) { dataset.controller.update(); }); this.render(animationDuration, lazy); + + Chart.pluginService.notifyPlugins('afterUpdate', this); }, render: function render(duration, lazy) { @@ -302,6 +305,8 @@ module.exports = function(Chart) { var easingDecimal = ease || 1; this.clear(); + Chart.pluginService.notifyPlugins('beforeDraw', this); + // Draw all the scales helpers.each(this.boxes, function(box) { box.draw(this.chartArea); @@ -328,6 +333,8 @@ module.exports = function(Chart) { // Finally draw the tooltip this.tooltip.transition(easingDecimal).draw(); + + Chart.pluginService.notifyPlugins('afterDraw', this); }, // Get the single element that was clicked on