Permalink
Browse files

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.
  • Loading branch information...
1 parent 0594a49 commit 4e9c0c0b53aca13fa3119876eb7c8d54807c86f6 @dnschnur dnschnur committed Mar 10, 2013
Showing with 7 additions and 4 deletions.
  1. +7 −4 jquery.flot.js
View
11 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);

0 comments on commit 4e9c0c0

Please sign in to comment.