Restore original canvas context when destroying

This commit is contained in:
Nick Downie 2015-01-06 23:44:51 +00:00
parent 7aa867cf24
commit 85f3755f9a

View File

@ -868,6 +868,21 @@
destroy : function(){ destroy : function(){
this.clear(); this.clear();
unbindEvents(this, this.events); unbindEvents(this, this.events);
var canvas = this.chart.canvas;
// Reset canvas height/width attributes starts a fresh with the canvas context
canvas.width = this.chart.width;
canvas.height = this.chart.height;
// < IE9 doesn't support removeProperty
if (canvas.style.removeProperty) {
canvas.style.removeProperty('width');
canvas.style.removeProperty('height');
} else {
canvas.style.removeAttribute('width');
canvas.style.removeAttribute('height');
}
delete Chart.instances[this.id]; delete Chart.instances[this.id];
}, },
showTooltip : function(ChartElements, forceRedraw){ showTooltip : function(ChartElements, forceRedraw){