From fa123b6e945fd2f0e05c04bff793b1c26c551cc4 Mon Sep 17 00:00:00 2001 From: Rufus Pollock Date: Mon, 30 Apr 2012 03:56:53 +0100 Subject: [PATCH] [bugfix,view-graph][xs]: hovers on bar graphs were wrong because we were not switching x,y due to it being horizontal. --- src/view-graph.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/view-graph.js b/src/view-graph.js index d9fe7873..e858a51d 100644 --- a/src/view-graph.js +++ b/src/view-graph.js @@ -301,6 +301,12 @@ my.Graph = Backbone.View.extend({ $("#flot-tooltip").remove(); var x = item.datapoint[0]; var y = item.datapoint[1]; + // it's horizontal so we have to flip + if (self.state.attributes.graphType === 'bars') { + var _tmp = x; + x = y; + y = _tmp; + } // convert back from 'index' value on x-axis (e.g. in cases where non-number values) if (self.model.currentDocuments.models[x]) { x = self.model.currentDocuments.models[x].get(self.state.attributes.group);