Be friendlier with options that exist, but are null, which is typical when updating...
[dygraphs.git] / dygraph.js
index 4189750..3a8c862 100644 (file)
@@ -603,13 +603,12 @@ Dygraph.prototype.attr_ = function(name, seriesName) {
   }
 
   var computedValue = seriesName ? this.attributes_.findForSeries(name, seriesName) : this.attributes_.find(name);
-
   if (ret !== computedValue) {
     console.log("Mismatch", name, seriesName, ret, computedValue);
-  } else {
-    console.log("Match", name, seriesName, ret, computedValue);
   }
-  return computedValue;
+
+  var USE_NEW_VALUE = true;
+  return USE_NEW_VALUE ? computedValue : ret;
 };
 
 /**
@@ -2971,6 +2970,7 @@ Dygraph.prototype.parseCSV_ = function(data) {
     // User hasn't explicitly set labels, so they're (presumably) in the CSV.
     start = 1;
     this.attrs_.labels = lines[0].split(delim);  // NOTE: _not_ user_attrs_.
+    this.attributes_.reparseSeries();
   }
   var line_no = 0;
 
@@ -3107,8 +3107,9 @@ Dygraph.prototype.parseArray_ = function(data) {
               "in the options parameter");
     this.attrs_.labels = [ "X" ];
     for (i = 1; i < data[0].length; i++) {
-      this.attrs_.labels.push("Y" + i);
+      this.attrs_.labels.push("Y" + i); // Not user_attrs_.
     }
+    this.attributes_.reparseSeries();
   } else {
     var num_labels = this.attr_("labels");
     if (num_labels.length != data[0].length) {