diff --git a/NEWS.txt b/NEWS.txt index fd44d81..696bd90 100644 --- a/NEWS.txt +++ b/NEWS.txt @@ -19,7 +19,9 @@ the fill. Fixed a bug in calculating spacing around the plot (reported by timothytoe). Fixed a bug in finding max values for all-negative data sets. Prevent the possibility of eternal looping in tick calculations. -Fixed a bug when borderWidth is set to 0 (reported by Rob/sanchothefat). +Fixed a bug when borderWidth is set to 0 (reported by +Rob/sanchothefat). Fixed a bug with drawing bars extending below 0 +(reported by James Hewitt, convenient patch by Ryan Funduk). Flot 0.4 diff --git a/jquery.flot.js b/jquery.flot.js index a033c4d..9edaf7e 100644 --- a/jquery.flot.js +++ b/jquery.flot.js @@ -1212,8 +1212,10 @@ var x = data[i][0], y = data[i][1]; var drawLeft = true, drawTop = true, drawRight = true; - var left = x, right = x + barWidth, bottom = 0, top = y; + // 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) continue;