X-Git-Url: https://adrianiainlam.tk/git/?a=blobdiff_plain;f=tests%2Flinear-regression-addseries.html;h=9a20fe8456fdd39b6a7b21092a7fe7be455d5b85;hb=606568fef36a321148399da4c58a05e2753ac2f9;hp=4445f471f14694585454afb3d7df1bd0df15ad00;hpb=227b93cc36500fbab1edab16880f1aa696f8a408;p=dygraphs.git diff --git a/tests/linear-regression-addseries.html b/tests/linear-regression-addseries.html index 4445f47..9a20fe8 100644 --- a/tests/linear-regression-addseries.html +++ b/tests/linear-regression-addseries.html @@ -1,8 +1,9 @@ + Linear Regression @@ -61,6 +62,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 +78,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 + "]"); }