X-Git-Url: https://adrianiainlam.tk/git/?a=blobdiff_plain;f=tests%2Flinear-regression-addseries.html;h=5e7986022ddb4ad990efae93bce3a3c832083e06;hb=421427956b54e7c1bea26f6865eaf007d406a2d2;hp=4445f471f14694585454afb3d7df1bd0df15ad00;hpb=227b93cc36500fbab1edab16880f1aa696f8a408;p=dygraphs.git
diff --git a/tests/linear-regression-addseries.html b/tests/linear-regression-addseries.html
index 4445f47..5e79860 100644
--- a/tests/linear-regression-addseries.html
+++ b/tests/linear-regression-addseries.html
@@ -1,13 +1,17 @@
+
+
Linear Regression
-
-
-
-
+
+
+
@@ -61,6 +65,10 @@
var y = data[i][series];
if (y == null) continue;
+ if (y.length == 2) {
+ // using fractions
+ y = y[0] / y[1];
+ }
num++;
sum_x += x;
@@ -73,7 +81,7 @@
var b = (sum_y - a * sum_x) / num;
coeffs[series] = [b, a];
- if (console) {
+ if (typeof(console) != 'undefined') {
console.log("coeffs(" + series + "): [" + b + ", " + a + "]");
}
@@ -92,7 +100,7 @@
// Darken the series by 50% to generate its regression.
var label = labels[i] + " Regression";
new_labels.push(label);
- var c = new RGBColor(orig_colors[i - 1]);
+ var c = new RGBColorParser(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));