summaryrefslogtreecommitdiff
path: root/addons/web_graph/static/src/js
diff options
context:
space:
mode:
authorXavier Morel <xmo@openerp.com>2012-06-08 09:03:12 +0200
committerXavier Morel <xmo@openerp.com>2012-06-08 09:03:12 +0200
commit30e491dfea0cd1a863a5bc5679b88d8c5256cad7 (patch)
treed4a2920c2ab9463b8f3ba5c060546f84f66fdbde /addons/web_graph/static/src/js
parent656ce51ae4f8bcf17b46bae5a5da352f9f64fa23 (diff)
[FIX] Crummy attempt to make flotr behave on min bounds
It apparently doesn't manage to correctly infer graph lower bound (at least) for stacked bar graphs, breaking the opportunities graph (y axis legend blows a gasket) and the purchases graph of the purchase dashboard (only displays part of the graph instead of starting from 0) bzr revid: xmo@openerp.com-20120608070312-du2plvx01io9cyk5
Diffstat (limited to 'addons/web_graph/static/src/js')
-rw-r--r--addons/web_graph/static/src/js/graph.js12
1 files changed, 10 insertions, 2 deletions
diff --git a/addons/web_graph/static/src/js/graph.js b/addons/web_graph/static/src/js/graph.js
index 448016541c9..52162285f27 100644
--- a/addons/web_graph/static/src/js/graph.js
+++ b/addons/web_graph/static/src/js/graph.js
@@ -139,6 +139,12 @@ instance.web_graph.GraphView = instance.web.View.extend({
},
options_bar: function (data) {
+ var min = _(data.data).chain()
+ .map(function (record) {
+ return _.min(record.data, function (item) {
+ return item[1];
+ })[1];
+ }).min().value();
return {
bars : {
show : true,
@@ -153,11 +159,13 @@ instance.web_graph.GraphView = instance.web.View.extend({
outline : "sw",
},
yaxis : {
- ticks: this.orientation ? data.ticks : false
+ ticks: this.orientation ? data.ticks : false,
+ min: !this.orientation ? (min < 0 ? min : 0) : null
},
xaxis : {
labelsAngle: 45,
- ticks: this.orientation ? false : data.ticks
+ ticks: this.orientation ? false : data.ticks,
+ min: this.orientation ? (min < 0 ? min : 0) : null
}
};
},