From: Dan Vanderkam Date: Mon, 15 Nov 2010 16:00:46 +0000 (-0500) Subject: fix drawing logic in underlayCallback X-Git-Tag: v1.0.0~603 X-Git-Url: https://adrianiainlam.tk/git/?a=commitdiff_plain;h=2fc82862911aedb6cd30287a040b827c75405512;p=dygraphs.git fix drawing logic in underlayCallback --- diff --git a/tests/underlay-callback.html b/tests/underlay-callback.html index 075f893..71857eb 100644 --- a/tests/underlay-callback.html +++ b/tests/underlay-callback.html @@ -29,10 +29,14 @@ underlayCallback: function(canvas, area, g) { var splitHeight = g.toDomCoords(null, 2.25)[1]; + // fillRect(x, y, width, height) + // Bottom section: y = (-Infinity, 2.25) canvas.fillStyle = 'pink'; - canvas.fillRect(area.x, area.y + area.h, area.w, -splitHeight); + canvas.fillRect(area.x, splitHeight, area.w, area.h - splitHeight); + + // Top section: y = (2.25, +Infinity) canvas.fillStyle = 'lightblue'; - canvas.fillRect(area.x, 0, area.w, area.y + area.h - splitHeight); + canvas.fillRect(area.x, area.y, area.w, splitHeight - area.y); } } );