Merge pull request #855 from nnnick/fix/reset-canvas

Restore original canvas context when destroying
This commit is contained in:
Evert Timberg
2015-01-06 19:17:01 -05:00

View File

@@ -868,6 +868,21 @@
destroy : function(){
this.clear();
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];
},
showTooltip : function(ChartElements, forceRedraw){