X-Git-Url: https://adrianiainlam.tk/git/?a=blobdiff_plain;f=tests%2Flinear-regression-addseries.html;h=ccbc28d2be5a6ad404972014136392ac927110da;hb=44f29e932dcbe83c1bfaebb8735579392e27a5df;hp=4445f471f14694585454afb3d7df1bd0df15ad00;hpb=895b3657b0ab22bb35815a1687c71116b2d8b36c;p=dygraphs.git diff --git a/tests/linear-regression-addseries.html b/tests/linear-regression-addseries.html index 4445f47..ccbc28d 100644 --- a/tests/linear-regression-addseries.html +++ b/tests/linear-regression-addseries.html @@ -1,8 +1,10 @@ + + Linear Regression @@ -61,6 +63,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 +79,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 + "]"); }