X-Git-Url: https://adrianiainlam.tk/git/?a=blobdiff_plain;f=tests%2Flinear-regression.html;h=95177e3776f1af4bc7af1e5b83fd2f578558762e;hb=44f29e932dcbe83c1bfaebb8735579392e27a5df;hp=bed74e0c6c155606a43fd03a998c6432fd9c40e9;hpb=34bbe78bab0cfe4a986802aa2e3dc5edbcc55c35;p=dygraphs.git diff --git a/tests/linear-regression.html b/tests/linear-regression.html index bed74e0..95177e3 100644 --- a/tests/linear-regression.html +++ b/tests/linear-regression.html @@ -1,8 +1,10 @@ + + Linear Regression @@ -35,7 +37,8 @@ { labels: ['X', 'Y1', 'Y2'], underlayCallback: drawLines, - drawPoints: true + drawPoints: true, + strokeWidth: 0.0 } ); @@ -54,6 +57,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; @@ -66,7 +73,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 + "]"); }