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.
pull/1/head
David Schnur 13 years ago
parent 0594a49158
commit 4e9c0c0b53

@ -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);

Loading…
Cancel
Save