Commit 088d6ae2 authored by olau@iola.dk's avatar olau@iola.dk

Fixed problem with ticks and the border (based on patch from

ultimatehustler69, issue 236)


git-svn-id: https://flot.googlecode.com/svn/trunk@227 1e0a6537-2640-0410-bfb7-f154510ff394
parent 356a27b6
...@@ -6,6 +6,8 @@ Bug fixes: ...@@ -6,6 +6,8 @@ Bug fixes:
- Fixed problem with findNearbyItem and bars on top of each other - Fixed problem with findNearbyItem and bars on top of each other
(reported by ragingchikn, issue 242). (reported by ragingchikn, issue 242).
- Fixed problem with ticks and the border (based on patch from
ultimatehustler69, issue 236).
Flot 0.6 Flot 0.6
...@@ -17,7 +19,7 @@ API changes: ...@@ -17,7 +19,7 @@ API changes:
passing selection: { mode: something }, you MUST include the file passing selection: { mode: something }, you MUST include the file
jquery.flot.selection.js after jquery.flot.js. This reduces the size jquery.flot.selection.js after jquery.flot.js. This reduces the size
of base Flot and makes it easier to customize the selection as well as of base Flot and makes it easier to customize the selection as well as
improving code clarity. The change is based on patch from andershol. improving code clarity. The change is based on a patch from andershol.
2. In the global options specified in the $.plot command, 2. In the global options specified in the $.plot command,
"lines", "points", "bars" and "shadowSize" have been moved to a "lines", "points", "bars" and "shadowSize" have been moved to a
......
...@@ -1175,11 +1175,13 @@ ...@@ -1175,11 +1175,13 @@
ctx.lineWidth = 1; ctx.lineWidth = 1;
ctx.strokeStyle = options.grid.tickColor; ctx.strokeStyle = options.grid.tickColor;
ctx.beginPath(); ctx.beginPath();
var v, axis = axes.xaxis; var v, axis = axes.xaxis,
bw = options.grid.borderWidth;
for (i = 0; i < axis.ticks.length; ++i) { for (i = 0; i < axis.ticks.length; ++i) {
v = axis.ticks[i].v; v = axis.ticks[i].v;
if (v <= axis.min || v >= axes.xaxis.max) if (v < axis.min || v > axis.max ||
continue; // skip those lying on the axes (bw > 0 && (v == axis.min || v == axis.max)))
continue; // skip those lying on the axes if we got a border
ctx.moveTo(Math.floor(axis.p2c(v)) + ctx.lineWidth/2, 0); ctx.moveTo(Math.floor(axis.p2c(v)) + ctx.lineWidth/2, 0);
ctx.lineTo(Math.floor(axis.p2c(v)) + ctx.lineWidth/2, plotHeight); ctx.lineTo(Math.floor(axis.p2c(v)) + ctx.lineWidth/2, plotHeight);
...@@ -1188,7 +1190,8 @@ ...@@ -1188,7 +1190,8 @@
axis = axes.yaxis; axis = axes.yaxis;
for (i = 0; i < axis.ticks.length; ++i) { for (i = 0; i < axis.ticks.length; ++i) {
v = axis.ticks[i].v; v = axis.ticks[i].v;
if (v <= axis.min || v >= axis.max) if (v < axis.min || v > axis.max ||
(bw > 0 && (v == axis.min || v == axis.max)))
continue; continue;
ctx.moveTo(0, Math.floor(axis.p2c(v)) + ctx.lineWidth/2); ctx.moveTo(0, Math.floor(axis.p2c(v)) + ctx.lineWidth/2);
...@@ -1198,7 +1201,8 @@ ...@@ -1198,7 +1201,8 @@
axis = axes.x2axis; axis = axes.x2axis;
for (i = 0; i < axis.ticks.length; ++i) { for (i = 0; i < axis.ticks.length; ++i) {
v = axis.ticks[i].v; v = axis.ticks[i].v;
if (v <= axis.min || v >= axis.max) if (v < axis.min || v > axis.max ||
(bw > 0 && (v == axis.min || v == axis.max)))
continue; continue;
ctx.moveTo(Math.floor(axis.p2c(v)) + ctx.lineWidth/2, -5); ctx.moveTo(Math.floor(axis.p2c(v)) + ctx.lineWidth/2, -5);
...@@ -1208,7 +1212,8 @@ ...@@ -1208,7 +1212,8 @@
axis = axes.y2axis; axis = axes.y2axis;
for (i = 0; i < axis.ticks.length; ++i) { for (i = 0; i < axis.ticks.length; ++i) {
v = axis.ticks[i].v; v = axis.ticks[i].v;
if (v <= axis.min || v >= axis.max) if (v < axis.min || v > axis.max ||
(bw > 0 && (v == axis.min || v == axis.max)))
continue; continue;
ctx.moveTo(plotWidth-5, Math.floor(axis.p2c(v)) + ctx.lineWidth/2); ctx.moveTo(plotWidth-5, Math.floor(axis.p2c(v)) + ctx.lineWidth/2);
...@@ -1219,7 +1224,6 @@ ...@@ -1219,7 +1224,6 @@
if (options.grid.borderWidth) { if (options.grid.borderWidth) {
// draw border // draw border
var bw = options.grid.borderWidth;
ctx.lineWidth = bw; ctx.lineWidth = bw;
ctx.strokeStyle = options.grid.borderColor; ctx.strokeStyle = options.grid.borderColor;
ctx.strokeRect(-bw/2, -bw/2, plotWidth + bw, plotHeight + bw); ctx.strokeRect(-bw/2, -bw/2, plotWidth + bw, plotHeight + bw);
......
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