mirror of
https://github.com/chartjs/Chart.js.git
synced 2024-10-06 04:09:08 +02:00
Restore original canvas context when destroying
This commit is contained in:
parent
7aa867cf24
commit
85f3755f9a
@ -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){
|
||||||
|
Loading…
Reference in New Issue
Block a user