Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Center bars on ticks (so their left side isn't at the datapoint, the …

…center is). Lighthouse ticket #6.
  • Loading branch information...
commit 2e837bc2cd6d7da2bde2c886714ea9307caa62ff 1 parent 976579a
@rfunduk rfunduk authored
Showing with 6 additions and 3 deletions.
  1. +1 −1  examples/graph-types.html
  2. +5 −2 jquery.flot.js
View
2  examples/graph-types.html
@@ -23,7 +23,7 @@
for (var i = 0; i < 14; i += 0.5)
d1.push([i, Math.sin(i)]);
- var d2 = [[0, 3], [4, 8], [8, 5], [9, 13]];
+ var d2 = [[0, 3], [5, 8], [8, 5], [10, 13]];
var d3 = [];
for (var i = 0; i < 14; i += 0.5)
View
7 jquery.flot.js
@@ -1450,8 +1450,11 @@
// determine the co-ordinates of the bar, account for negative bars having
// flipped top/bottom and draw/don't draw accordingly
- var left = x, right = x + barWidth, bottom = (y < 0 ? y : 0), top = (y < 0 ? 0 : y);
- if (right < xaxis.min || left > xaxis.max || top < yaxis.min || bottom > yaxis.max)
+ var halfBar = barWidth / 2;
+ var left = x - halfBar, right = x + halfBar,
+ bottom = (y < 0 ? y : 0), top = (y < 0 ? 0 : y);
+ if (right < xaxis.min || left > xaxis.max ||
+ top < yaxis.min || bottom > yaxis.max)
continue;
// clip
Please sign in to comment.
Something went wrong with that request. Please try again.