X-Git-Url: https://adrianiainlam.tk/git/?a=blobdiff_plain;f=dygraph.js;h=49ecc3eb54122c606d21b0b2f42ba8343b6f73a8;hb=c715be428d83d80c0a26fd60dc5bc36fb4c908d9;hp=026365bbfad189d44b0ec973fd21c408b7f236cb;hpb=c48464988da6eaee534f934c73f438e18eccf144;p=dygraphs.git diff --git a/dygraph.js b/dygraph.js index 026365b..49ecc3e 100644 --- a/dygraph.js +++ b/dygraph.js @@ -46,6 +46,7 @@ // For "production" code, this gets set to false by uglifyjs. if (typeof(DEBUG) === 'undefined') DEBUG=true; +var Dygraph = (function() { /*jshint globalstrict: true */ /*global DygraphLayout:false, DygraphCanvasRenderer:false, DygraphOptions:false, G_vmlCanvasManager:false,ActiveXObject:false */ "use strict"; @@ -334,7 +335,6 @@ Dygraph.DEFAULT_ATTRS = { axisLineWidth: 0.3, gridLineWidth: 0.3, axisLabelColor: "black", - axisLabelFont: "Arial", // TODO(danvk): is this implemented? axisLabelWidth: 50, drawYGrid: true, drawXGrid: true, @@ -1230,6 +1230,12 @@ Dygraph.prototype.destroy = function() { this.canvas_ctx_.restore(); this.hidden_ctx_.restore(); + // Destroy any plugins, in the reverse order that they were registered. + for (var i = this.plugins_.length - 1; i >= 0; i--) { + var p = this.plugins_.pop(); + if (p.plugin.destroy) p.plugin.destroy(); + } + var removeRecursive = function(node) { while (node.hasChildNodes()) { removeRecursive(node.firstChild); @@ -1244,7 +1250,7 @@ Dygraph.prototype.destroy = function() { Dygraph.removeEvent(this.mouseEventElement_, 'mousemove', this.mouseMoveHandler_); // remove window handlers - Dygraph.removeEvent(window,'resize',this.resizeHandler_); + Dygraph.removeEvent(window,'resize', this.resizeHandler_); this.resizeHandler_ = null; removeRecursive(this.maindiv_); @@ -3788,3 +3794,7 @@ Dygraph.addAnnotationRule = function() { console.warn("Unable to add default annotation CSS rule; display may be off."); }; + +return Dygraph; + +})();