From: Dan Vanderkam Date: Tue, 26 Jan 2010 09:06:07 +0000 (-0800) Subject: Fix issue 67 and add a test X-Git-Tag: v1.0.0~748 X-Git-Url: https://adrianiainlam.tk/git/?a=commitdiff_plain;h=ec1959eb750272c89d2f9ce4587d13363682749a;p=dygraphs.git Fix issue 67 and add a test --- 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: + + + + + + +

+ + + +