From 34bbe78bab0cfe4a986802aa2e3dc5edbcc55c35 Mon Sep 17 00:00:00 2001 From: Dan Vanderkam Date: Wed, 15 Sep 2010 21:19:04 -0400 Subject: [PATCH] two different versions; tweak color logic --- tests/linear-regression-addseries.html | 165 +++++++++++++++++++++++++++++++++ tests/linear-regression.html | 6 +- 2 files changed, 170 insertions(+), 1 deletion(-) create mode 100644 tests/linear-regression-addseries.html diff --git a/tests/linear-regression-addseries.html b/tests/linear-regression-addseries.html new file mode 100644 index 0000000..3aa0632 --- /dev/null +++ b/tests/linear-regression-addseries.html @@ -0,0 +1,165 @@ + + + Linear Regression + + + + + + + + +

Linear Regression Demo

+

Click the buttons to generate linear regressions over either data + series. If you zoom in and 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.

+ +
+ + + +
+ +

+ +

+ +
+ + diff --git a/tests/linear-regression.html b/tests/linear-regression.html index e3636c1..bed74e0 100644 --- a/tests/linear-regression.html +++ b/tests/linear-regression.html @@ -95,7 +95,11 @@ var p1 = g.toDomCoords(x1, y1); var p2 = g.toDomCoords(x2, y2); - var color = g.getColors()[i - 1]; + var c = new RGBColor(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)); + var color = c.toHex(); ctx.save(); ctx.strokeStyle = color; ctx.lineWidth = 1.0; -- 2.7.4