Fix issue 247 and flesh out its regression test.
authorDan Vanderkam <danvk@google.com>
Fri, 16 Dec 2011 22:45:18 +0000 (17:45 -0500)
committerDan Vanderkam <danvk@google.com>
Fri, 16 Dec 2011 22:45:18 +0000 (17:45 -0500)
auto_tests/tests/update_options.js
dygraph-utils.js

index b40d705..28cc840 100644 (file)
@@ -136,11 +136,18 @@ UpdateOptionsTestCase.prototype.testUpdateColors = function() {
   graph.updateOptions({ colors: colors1 });
   assertEquals(colors1, graph.getColors());
 
+  // extra colors are ignored until you add additional data series.
   var colors2 = [ "#aaa", "#bbb", "#ccc" ];
   graph.updateOptions({ colors: colors2 });
-  assertEquals(colors2, graph.getColors());
+  assertEquals(colors1, graph.getColors());
 
+  graph.updateOptions({ file:
+      "X,Y1,Y2,Y3\n" +
+      "2011-01-01,2,3,4\n" +
+      "2011-02-02,5,3,2\n"
+  });
+  assertEquals(colors2, graph.getColors());
 
-  graph.updateOptions({ colors: null });
+  graph.updateOptions({ colors: null, file: this.data });
   assertEquals(defaultColors, graph.getColors());
 }
index db04314..be1c7fb 100644 (file)
@@ -642,9 +642,6 @@ Dygraph.isPixelChangingOptionList = function(labels, attrs) {
     'axisLineColor': true,
     'axisLineWidth': true,
     'clickCallback': true,
-    'colorSaturation': true,
-    'colorValue': true,
-    'colors': true,
     'digitsAfterDecimal': true,
     'drawCallback': true,
     'drawPoints': true,