X-Git-Url: https://adrianiainlam.tk/git/?a=blobdiff_plain;f=tests%2Flinear-regression-addseries.html;h=3fd3a85c01f3a507b8e4870363d9d4d2c1cbfa60;hb=92fd68d8d81bbe54bae58e4c02c9a2466cab966c;hp=4445f471f14694585454afb3d7df1bd0df15ad00;hpb=227b93cc36500fbab1edab16880f1aa696f8a408;p=dygraphs.git diff --git a/tests/linear-regression-addseries.html b/tests/linear-regression-addseries.html index 4445f47..3fd3a85 100644 --- a/tests/linear-regression-addseries.html +++ b/tests/linear-regression-addseries.html @@ -2,7 +2,7 @@ Linear Regression @@ -61,6 +61,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 +77,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 + "]"); }