X-Git-Url: https://adrianiainlam.tk/git/?a=blobdiff_plain;f=dygraph.js;h=bd3a4cc3261f8fb13051dfa035f81aa3caf57c08;hb=6a6439da128e23cdb0af494f9185b683ee7f674c;hp=aa8d8483404ce12add417c2208a6a4685c349d27;hpb=ee53deb9db465f5eea54e102ca755decef005496;p=dygraphs.git diff --git a/dygraph.js b/dygraph.js index aa8d848..bd3a4cc 100644 --- a/dygraph.js +++ b/dygraph.js @@ -1090,8 +1090,6 @@ Dygraph.prototype.setColors_ = function() { this.colorsMap_[labels[1 + i]] = colorStr; } } - - this.plotter_.setColors(this.colors_); }; /** @@ -1128,7 +1126,7 @@ Dygraph.prototype.getPropertiesForSeries = function(series_name) { name: series_name, column: idx, visible: this.visibility()[idx - 1], - color: this.plotter_.colors[series_name], + color: this.colorsMap_[series_name], axis: 1 + this.seriesToAxisMap_[series_name] }; }; @@ -2341,7 +2339,20 @@ Dygraph.prototype.renderGraph_ = function(is_initial_draw) { this.cascadeEvents_('clearChart'); this.plotter_.clear(); + if (this.attr_('underlayCallback')) { + // NOTE: we pass the dygraph object to this callback twice to avoid breaking + // users who expect a deprecated form of this callback. + this.attr_('underlayCallback')( + this.hidden_ctx_, this.layout_.getPlotArea(), this, this); + } + + var e = { + canvas: this.hidden_, + drawingContext: this.hidden_ctx_, + }; + this.cascadeEvents_('willDrawChart', e); this.plotter_.render(); + this.cascadeEvents_('didDrawChart', e); // TODO(danvk): is this a performance bottleneck when panning? // The interaction canvas should already be empty in that situation. @@ -2353,11 +2364,6 @@ Dygraph.prototype.renderGraph_ = function(is_initial_draw) { if (this.rangeSelector_) { this.rangeSelector_.renderInteractiveLayer(); } - - this.cascadeEvents_('drawChart', { - canvas: this.hidden_, - drawingContext: this.hidden_ctx_, - }); if (this.attr_("drawCallback") !== null) { this.attr_("drawCallback")(this, is_initial_draw); } @@ -3504,6 +3510,7 @@ Dygraph.prototype.datasetIndexFromSetName_ = function(name) { * called once -- all calls after the first will return immediately. */ Dygraph.addAnnotationRule = function() { + // TODO(danvk): move this function into plugins/annotations.js? if (Dygraph.addedAnnotationCSS) return; var rule = "border: 1px solid black; " +