From 06303c32a7bedc5befa31f49bec347bca59fb2e7 Mon Sep 17 00:00:00 2001 From: Dan Vanderkam Date: Sun, 10 Apr 2011 15:13:29 -0400 Subject: [PATCH] update legend when updateOptions() is called --- dygraph.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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) { -- 2.7.4