X-Git-Url: https://adrianiainlam.tk/git/?a=blobdiff_plain;f=tests%2Flinear-regression-addseries.html;h=7c7646d245e38d6b28d5ee5e11a3e05044ce46c0;hb=966ac3fa0de18a7b5ddefe4aba6938d8358ea0cf;hp=4445f471f14694585454afb3d7df1bd0df15ad00;hpb=227b93cc36500fbab1edab16880f1aa696f8a408;p=dygraphs.git diff --git a/tests/linear-regression-addseries.html b/tests/linear-regression-addseries.html index 4445f47..7c7646d 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 + "]"); }