"didDrawChart"
], events);
};
+
+pluginsTestCase.prototype.testDestroyCalledInOrder = function() {
+ var destructions = [];
+ var makePlugin = function(name) {
+ return {
+ activate: function(g) { return {} },
+ destroy: function() {
+ destructions.push(name);
+ }
+ };
+ };
+
+ var graph = document.getElementById("graph");
+ var g = new Dygraph(graph, this.data, {
+ plugins: [makePlugin('p'), makePlugin('q')]
+ });
+
+ assertEquals([], destructions);
+ g.destroy();
+ assertEquals(['q', 'p'], destructions);
+};
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);
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_);