From 62bd8ffda7894e2c4e3740661d7d546b9ed81f10 Mon Sep 17 00:00:00 2001 From: John Glover Date: Wed, 20 Feb 2013 11:43:42 +0000 Subject: [PATCH] [#324] Bug fix: fix tooltip content and placement in flot bar graph. --- src/view.flot.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/view.flot.js b/src/view.flot.js index ea87f40f..834cf63f 100644 --- a/src/view.flot.js +++ b/src/view.flot.js @@ -115,6 +115,11 @@ my.Flot = Backbone.View.extend({ var x = item.datapoint[0].toFixed(2), y = item.datapoint[1].toFixed(2); + if (this.state.attributes.graphType === 'bars') { + x = item.datapoint[1].toFixed(2), + y = item.datapoint[0].toFixed(2); + } + var content = _.template('<%= group %> = <%= x %>, <%= series %> = <%= y %>', { group: this.state.attributes.group, x: this._xaxisLabel(x), @@ -125,6 +130,9 @@ my.Flot = Backbone.View.extend({ // use a different tooltip location offset for bar charts var xLocation, yLocation; if (this.state.attributes.graphType === 'bars') { + xLocation = item.pageX + 15; + yLocation = item.pageY - 10; + } else if (this.state.attributes.graphType === 'columns') { xLocation = item.pageX + 15; yLocation = item.pageY; } else {