From: Dan Vanderkam Date: Sun, 10 Apr 2011 19:13:29 +0000 (-0400) Subject: update legend when updateOptions() is called X-Git-Tag: v1.0.0~524^2~2 X-Git-Url: https://adrianiainlam.tk/git/?a=commitdiff_plain;h=06303c32a7bedc5befa31f49bec347bca59fb2e7;p=dygraphs.git update legend when updateOptions() is called --- diff --git a/dygraph.js b/dygraph.js index 4227652..958d1f3 100644 --- a/dygraph.js +++ b/dygraph.js @@ -1811,7 +1811,6 @@ Dygraph.prototype.setSelection = function(row) { this.lastx_ = this.selPoints_[0].xval; this.updateSelection_(); } else { - this.lastx_ = -1; this.clearSelection(); } @@ -2630,6 +2629,13 @@ Dygraph.prototype.drawGraph_ = function() { if (is_initial_draw) { // Generate a static legend before any particular point is selected. this.attr_('labelsDiv').innerHTML = this.generateLegendHTML_(); + } else { + if (typeof(this.selPoints_) !== 'undefined' && this.selPoints_.length) { + this.lastx_ = this.selPoints_[0].xval; + this.updateSelection_(); + } else { + this.clearSelection(); + } } if (this.attr_("drawCallback") !== null) {