change to an implementation based on set names
[dygraphs.git] / tests / linear-regression-addseries.html
index 530cea3..4445f47 100644 (file)
         for (var i = 0; i < labels.length; i++) {
           new_labels.push(labels[i]);
           if (i) new_colors.push(orig_colors[i - 1]);
-          new_opts[new_colors.length] = null;
           if (coeffs[i]) {
             // Darken the series by 50% to generate its regression.
-            new_labels.push(labels[i] + " Regression");
+            var label = labels[i] + " Regression";
+            new_labels.push(label);
             var c = new RGBColor(orig_colors[i - 1]);
             c.r = Math.floor(255 - 0.5 * (255 - c.r));
             c.g = Math.floor(255 - 0.5 * (255 - c.g));
             c.b = Math.floor(255 - 0.5 * (255 - c.b));
             new_colors.push(c.toHex());
-            new_opts[new_colors.length] = {
+            new_opts[label] = {
               drawPoints: false,
               strokeWidth: 1.0
             };