mirror of
https://github.com/chartjs/Chart.js.git
synced 2024-10-07 04:39:06 +02:00
Remove clipping and add plugin hooks. Zoom plugin can then do the clipping itself
This commit is contained in:
parent
a4ac33df5d
commit
b22e32c007
@ -288,12 +288,7 @@ module.exports = function(Chart) {
|
|||||||
this.scale.draw();
|
this.scale.draw();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Clip out the chart area so that anything outside does not draw. This is necessary for zoom and pan to function
|
Chart.pluginService.notifyPlugins('beforeElementDraw', [this, easingDecimal]);
|
||||||
var context = this.chart.ctx;
|
|
||||||
context.save();
|
|
||||||
context.beginPath();
|
|
||||||
context.rect(this.chartArea.left, this.chartArea.top, this.chartArea.right - this.chartArea.left, this.chartArea.bottom - this.chartArea.top);
|
|
||||||
context.clip();
|
|
||||||
|
|
||||||
// Draw each dataset via its respective controller (reversed to support proper line stacking)
|
// Draw each dataset via its respective controller (reversed to support proper line stacking)
|
||||||
helpers.each(this.data.datasets, function(dataset, datasetIndex) {
|
helpers.each(this.data.datasets, function(dataset, datasetIndex) {
|
||||||
@ -302,8 +297,7 @@ module.exports = function(Chart) {
|
|||||||
}
|
}
|
||||||
}, this, true);
|
}, this, true);
|
||||||
|
|
||||||
// Restore from the clipping operation
|
Chart.pluginService.notifyPlugins('afterElementDraw', [this, easingDecimal]);
|
||||||
context.restore();
|
|
||||||
|
|
||||||
// Finally draw the tooltip
|
// Finally draw the tooltip
|
||||||
this.tooltip.transition(easingDecimal).draw();
|
this.tooltip.transition(easingDecimal).draw();
|
||||||
|
Loading…
Reference in New Issue
Block a user