Docs on new plugin callback

This commit is contained in:
Evert Timberg
2016-05-31 22:28:22 -04:00
parent b22e32c007
commit b96fdcaf85
2 changed files with 6 additions and 3 deletions

View 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) { }
}

View 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