Commit 9b3ef35d authored by olau@iola.dk's avatar olau@iola.dk

Make sure measurement labels are deleted, round widths of labels, fix

recently introduced border margin calculation bug


git-svn-id: https://flot.googlecode.com/svn/trunk@259 1e0a6537-2640-0410-bfb7-f154510ff394
parent 81553910
......@@ -804,7 +804,7 @@
// them, we don't need the exact figures and the
// fixed-size box content is easy to center
if (w == null)
w = canvasWidth / (ticks.length > 0 ? ticks.length : 1);
w = Math.floor(canvasWidth / (ticks.length > 0 ? ticks.length : 1));
// measure x label heights
if (h == null) {
......@@ -839,6 +839,7 @@
w = dummyDiv.children().width();
if (h == null)
h = dummyDiv.find("div.tickLabel").height();
dummyDiv.remove();
}
}
......@@ -968,13 +969,15 @@
// make sure we've got enough space for things that
// might stick out
var maxOutset = options.grid.borderWidth;
var maxOutset = 0;
for (var i = 0; i < series.length; ++i)
maxOutset = Math.max(maxOutset, 2 * (series[i].points.radius + series[i].points.lineWidth/2));
for (var a in plotOffset)
for (var a in plotOffset) {
plotOffset[a] += options.grid.borderWidth;
plotOffset[a] = Math.max(maxOutset, plotOffset[a]);
}
}
plotWidth = canvasWidth - plotOffset.left - plotOffset.right;
plotHeight = canvasHeight - plotOffset.bottom - plotOffset.top;
......@@ -1495,17 +1498,17 @@
// find the edges
if (axis.direction == "x") {
x = 0;
if (axis.position == "bottom")
y = box.top - plotOffset.top;
if (t == "full")
y = (axis.position == "top" ? 0 : plotHeight);
else
y = box.top - plotOffset.top + box.height;
y = box.top - plotOffset.top + (axis.position == "top" ? box.height : 0);
}
else {
y = 0;
if (axis.position == "left")
x = box.left - plotOffset.left + box.width;
if (t == "full")
x = (axis.position == "left" ? 0 : plotWidth);
else
x = box.left - plotOffset.left;
x = box.left - plotOffset.left + (axis.position == "left" ? box.width : 0);
}
// draw tick bar
......@@ -1556,7 +1559,9 @@
}
if (ctx.lineWidth == 1) {
if (axis.direction == "x")
x = Math.floor(x) + 0.5;
else
y = Math.floor(y) + 0.5;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment