Fix bug with using aboveData with a background (reported by amitayd)

git-svn-id: https://flot.googlecode.com/svn/trunk@283 1e0a6537-2640-0410-bfb7-f154510ff394
pull/1/head
olau@iola.dk 16 years ago
parent eb03ceca9f
commit a1f56d5bd9

@ -111,6 +111,8 @@ Bug fixes:
- Listen for mouseleave events and fire a plothover event with empty - Listen for mouseleave events and fire a plothover event with empty
item when it occurs to drop highlights when the mouse leaves the item when it occurs to drop highlights when the mouse leaves the
plot (reported by by outspirit). plot (reported by by outspirit).
- Fix bug with using aboveData with a background (reported by amitayd).
Flot 0.6 Flot 0.6
-------- --------

@ -1363,6 +1363,10 @@
ctx.clearRect(0, 0, canvasWidth, canvasHeight); ctx.clearRect(0, 0, canvasWidth, canvasHeight);
var grid = options.grid; var grid = options.grid;
// draw background, if any
if (grid.show && grid.backgroundColor)
drawBackground();
if (grid.show && !grid.aboveData) if (grid.show && !grid.aboveData)
drawGrid(); drawGrid();
@ -1413,18 +1417,21 @@
return { from: from, to: to, axis: axis }; return { from: from, to: to, axis: axis };
} }
function drawBackground() {
ctx.save();
ctx.translate(plotOffset.left, plotOffset.top);
ctx.fillStyle = getColorOrGradient(options.grid.backgroundColor, plotHeight, 0, "rgba(255, 255, 255, 0)");
ctx.fillRect(0, 0, plotWidth, plotHeight);
ctx.restore();
}
function drawGrid() { function drawGrid() {
var i; var i;
ctx.save(); ctx.save();
ctx.translate(plotOffset.left, plotOffset.top); ctx.translate(plotOffset.left, plotOffset.top);
// draw background, if any
if (options.grid.backgroundColor) {
ctx.fillStyle = getColorOrGradient(options.grid.backgroundColor, plotHeight, 0, "rgba(255, 255, 255, 0)");
ctx.fillRect(0, 0, plotWidth, plotHeight);
}
// draw markings // draw markings
var markings = options.grid.markings; var markings = options.grid.markings;
if (markings) { if (markings) {

Loading…
Cancel
Save