From 4e9c0c0b53aca13fa3119876eb7c8d54807c86f6 Mon Sep 17 00:00:00 2001 From: David Schnur Date: Sat, 9 Mar 2013 22:34:11 -0500 Subject: [PATCH] Ensure that axis lines align with their ticks. Add an extra pixel to ensure that the lines cleanly join both top and bottom ticks. Also apply the sub-pixel offset only in the necessary direction, so the lines don't start a pixel off from where they should. --- jquery.flot.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/jquery.flot.js b/jquery.flot.js index 9486fa4..8f6023f 100644 --- a/jquery.flot.js +++ b/jquery.flot.js @@ -1873,13 +1873,16 @@ Licensed under the MIT license. ctx.beginPath(); xoff = yoff = 0; if (axis.direction == "x") - xoff = plotWidth; + xoff = plotWidth + 1; else - yoff = plotHeight; + yoff = plotHeight + 1; if (ctx.lineWidth == 1) { - x = Math.floor(x) + 0.5; - y = Math.floor(y) + 0.5; + if (axis.direction == "x") { + y = Math.floor(y) + 0.5; + } else { + x = Math.floor(x) + 0.5; + } } ctx.moveTo(x, y);