// Create a new plotter.
if (this.plotter_) {
- this.cascadeEvents_('clear');
+ this.cascadeEvents_('clearChart');
this.plotter_.clear();
}
this.plotter_ = new DygraphCanvasRenderer(this,
* @private
*/
Dygraph.prototype.renderGraph_ = function(is_initial_draw) {
- this.cascadeEvents_('clear');
+ this.cascadeEvents_('clearChart');
this.plotter_.clear();
this.plotter_.render();
chart_labels.prototype.activate = function(g) {
return {
- layout: this.layout
+ layout: this.layout,
+ // clearChart: this.clearChart,
+ drawChart: this.drawChart
};
};
return div;
};
+// Detach and null out any existing nodes.
+chart_labels.prototype.detachLabels_ = function() {
+ var els = [ this.title_div_,
+ this.xlabel_div_,
+ this.ylabel_div_,
+ this.y2label_div_ ];
+ for (var i = 0; i < els.length; i++) {
+ var el = els[i];
+ if (!el) continue;
+ if (el.parentNode) el.parentNode.removeChild(el);
+ }
+
+ this.title_div_ = null;
+ this.xlabel_div_ = null;
+ this.ylabel_div_ = null;
+ this.y2label_div_ = null;
+};
+
chart_labels.prototype.layout = function(e) {
+ this.detachLabels_();
+
var g = e.dygraph;
var div = e.chart_div;
if (g.getOption('title')) {
*/
};
+chart_labels.prototype.drawChart = function(e) {
+ var g = e.dygraph;
+ if (this.title_div_) {
+ this.title_div_.innerHTML = g.getOption('title');
+ }
+};
+
+chart_labels.prototype.clearChart = function() {
+};
+
chart_labels.prototype.destroy = function() {
- this.title_div_ = null;
- this.xlabel_div_ = null;
- this.ylabel_div_ = null;
- this.y2label_div_ = null;
+ detachLabels();
};