From ec1959eb750272c89d2f9ce4587d13363682749a Mon Sep 17 00:00:00 2001 From: Dan Vanderkam Date: Tue, 26 Jan 2010 01:06:07 -0800 Subject: [PATCH] Fix issue 67 and add a test --- dygraph.js | 2 ++ tests/color-visibility.html | 41 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 43 insertions(+) create mode 100644 tests/color-visibility.html diff --git a/dygraph.js b/dygraph.js index 30bb7e6..a08f668 100644 --- a/dygraph.js +++ b/dygraph.js @@ -397,11 +397,13 @@ Dygraph.prototype.setColors_ = function() { var sat = this.attr_('colorSaturation') || 1.0; var val = this.attr_('colorValue') || 0.5; for (var i = 1; i <= num; i++) { + if (!this.visibility()[i-1]) continue; var hue = (1.0*i/(1+num)); this.colors_.push( Dygraph.hsvToRGB(hue, sat, val) ); } } else { for (var i = 0; i < num; i++) { + if (!this.visibility()[i]) continue; var colorStr = colors[i % colors.length]; this.colors_.push(colorStr); } diff --git a/tests/color-visibility.html b/tests/color-visibility.html new file mode 100644 index 0000000..c72c1d6 --- /dev/null +++ b/tests/color-visibility.html @@ -0,0 +1,41 @@ + + + color visibility + + + + + + +

The lines should maintain their colors as their visibility is toggled.

+ +
+

Display: + + + + + + +

+ + + + -- 2.7.4