X-Git-Url: https://adrianiainlam.tk/git/?a=blobdiff_plain;f=gallery%2Flinear-regression.js;h=11caff2f6a51cf032dc4846aacb18329ee56d87c;hb=32c4d92b20add8400502e8d7b1337f2170fc987c;hp=0a93b8f85bf5c590c41536454338e0b0de8797a7;hpb=60bda09c058d85b1fad278ac4ce6df353e0a9275;p=dygraphs.git diff --git a/gallery/linear-regression.js b/gallery/linear-regression.js index 0a93b8f..11caff2 100644 --- a/gallery/linear-regression.js +++ b/gallery/linear-regression.js @@ -1,21 +1,20 @@ -// Use this as a template for new Gallery entries. Gallery.register( 'linear-regression', { name: 'Linear Regressions', title: 'Linear Regression Demo', setup: function(parent) { - parent.innerHTML = - "

Click the buttons to generate linear regressions over either data "+ - "series. If you zoom in and then click the regression button, the regression "+ - "will only be run over visible points. Zoom back out to see what the local "+ - "regression looks like over the full data.

"+ - "
" + - "
" + - " " + - " " + - "" + - "
"; + parent.innerHTML = [ + "

Click the buttons to generate linear regressions over either data ", + "series. If you zoom in and then click the regression button, the regression ", + "will only be run over visible points. Zoom back out to see what the local ", + "regression looks like over the full data.

", + "
", + "
", + " ", + " ", + "", + "
"].join("\n"); }, run: function() { document.getElementById("ry1").onclick = function() { regression(1) }; @@ -89,7 +88,7 @@ Gallery.register( var p1 = g.toDomCoords(x1, y1); var p2 = g.toDomCoords(x2, y2); - var c = new RGBColor(g.getColors()[i - 1]); + var c = new RGBColorParser(g.getColors()[i - 1]); c.r = Math.floor(255 - 0.5 * (255 - c.r)); c.g = Math.floor(255 - 0.5 * (255 - c.g)); c.b = Math.floor(255 - 0.5 * (255 - c.b)); @@ -113,6 +112,7 @@ Gallery.register( labels: ['X', 'Y1', 'Y2'], underlayCallback: drawLines, drawPoints: true, + drawAxesAtZero: true, strokeWidth: 0.0 } );