projects
/
dygraphs.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
code review
[dygraphs.git]
/
dygraph.js
diff --git
a/dygraph.js
b/dygraph.js
index
c8a1ccf
..
49ecc3e
100644
(file)
--- 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;
// 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";
/*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",
axisLineWidth: 0.3,
gridLineWidth: 0.3,
axisLabelColor: "black",
- axisLabelFont: "Arial", // TODO(danvk): is this implemented?
axisLabelWidth: 50,
drawYGrid: true,
drawXGrid: true,
axisLabelWidth: 50,
drawYGrid: true,
drawXGrid: true,
@@
-1230,6
+1230,12
@@
Dygraph.prototype.destroy = function() {
this.canvas_ctx_.restore();
this.hidden_ctx_.restore();
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);
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(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_);
this.resizeHandler_ = null;
removeRecursive(this.maindiv_);
@@
-2358,12
+2364,6
@@
Dygraph.prototype.predraw_ = function() {
// TODO(danvk): move more computations out of drawGraph_ and into here.
this.computeYAxes_();
// TODO(danvk): move more computations out of drawGraph_ and into here.
this.computeYAxes_();
- // Create a new plotter.
- if (this.plotter_) {
- this.cascadeEvents_('clearChart');
- this.plotter_.clear();
- }
-
if (!this.is_initial_draw_) {
this.canvas_ctx_.restore();
this.hidden_ctx_.restore();
if (!this.is_initial_draw_) {
this.canvas_ctx_.restore();
this.hidden_ctx_.restore();
@@
-2372,6
+2372,7
@@
Dygraph.prototype.predraw_ = function() {
this.canvas_ctx_.save();
this.hidden_ctx_.save();
this.canvas_ctx_.save();
this.hidden_ctx_.save();
+ // Create a new plotter.
this.plotter_ = new DygraphCanvasRenderer(this,
this.hidden_,
this.hidden_ctx_,
this.plotter_ = new DygraphCanvasRenderer(this,
this.hidden_,
this.hidden_ctx_,
@@
-3793,3
+3794,7
@@
Dygraph.addAnnotationRule = function() {
console.warn("Unable to add default annotation CSS rule; display may be off.");
};
console.warn("Unable to add default annotation CSS rule; display may be off.");
};
+
+return Dygraph;
+
+})();