]> git.ipfire.org Git - thirdparty/Chart.js.git/commitdiff
Restore original canvas context when destroying 855/head
authorNick Downie <hello@nickdownie.com>
Tue, 6 Jan 2015 23:44:51 +0000 (23:44 +0000)
committerNick Downie <hello@nickdownie.com>
Tue, 6 Jan 2015 23:44:51 +0000 (23:44 +0000)
src/Chart.Core.js

index 36a60841a984aa63c1bf6c9ed4a8c1b0d3e787f2..b71903e5188d0e534cc59920cf77d324195c7c0a 100755 (executable)
                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){