X-Git-Url: https://adrianiainlam.tk/git/?a=blobdiff_plain;f=tests%2Flinear-regression.html;h=bc629a0e7c72c6a4cacc63bf9bf35e768664ed7a;hb=606568fef36a321148399da4c58a05e2753ac2f9;hp=9f18d589f980d8217854bf068fbb2e5dd8f973ff;hpb=895b3657b0ab22bb35815a1687c71116b2d8b36c;p=dygraphs.git diff --git a/tests/linear-regression.html b/tests/linear-regression.html index 9f18d58..bc629a0 100644 --- a/tests/linear-regression.html +++ b/tests/linear-regression.html @@ -1,8 +1,9 @@ + Linear Regression @@ -55,6 +56,10 @@ var y = g.getValue(i, series); if (y == null) continue; + if (y.length == 2) { + // using fractions + y = y[0] / y[1]; + } num++; sum_x += x; @@ -67,7 +72,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 + "]"); }