From fa11f4e40237910cd7c5a6854943cc39ebc049f8 Mon Sep 17 00:00:00 2001 From: Dan Vanderkam Date: Sat, 16 Feb 2013 23:36:15 -0500 Subject: [PATCH] Fix & regression test for issue 363: Calling setSelection() after an updateOptions may have no effect --- auto_tests/tests/stacked.js | 5 +++-- dygraph.js | 1 + 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/auto_tests/tests/stacked.js b/auto_tests/tests/stacked.js index de41733..d9aadbf 100644 --- a/auto_tests/tests/stacked.js +++ b/auto_tests/tests/stacked.js @@ -86,8 +86,9 @@ stackedTestCase.prototype.testSelectionValues = function() { strokeWidth: 10 } }); - // NOTE: calling g.setSelection(0) here makes the test fail, due to an - // unrelated bug. + g.setSelection(0); + assertEquals("0: Y1: 1 Y2: 1", Util.getLegend()); + g.setSelection(1); assertEquals("1: Y1: 1 Y2: 1", Util.getLegend()); diff --git a/dygraph.js b/dygraph.js index 3dfc326..af1ca65 100644 --- a/dygraph.js +++ b/dygraph.js @@ -2472,6 +2472,7 @@ Dygraph.prototype.renderGraph_ = function(is_initial_draw) { this.cascadeEvents_('willDrawChart', e); this.plotter_.render(); this.cascadeEvents_('didDrawChart', e); + this.lastRow_ = -1; // because plugins/legend.js clears the legend // TODO(danvk): is this a performance bottleneck when panning? // The interaction canvas should already be empty in that situation. -- 2.7.4