From 1323c2c25b01d894f731fd1c2f76d5fabd610223 Mon Sep 17 00:00:00 2001 From: Gery Debongnie Date: Wed, 18 Dec 2013 16:20:48 +0100 Subject: [PATCH] [IMP] adds stacked/grouped setting to chart widget (addon web_graph) bzr revid: ged@openerp.com-20131218152048-36no38nud6a5ft10 --- addons/web_graph/static/src/js/graph.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/addons/web_graph/static/src/js/graph.js b/addons/web_graph/static/src/js/graph.js index 3c0fe1a8be5..145ee079c07 100644 --- a/addons/web_graph/static/src/js/graph.js +++ b/addons/web_graph/static/src/js/graph.js @@ -165,6 +165,7 @@ instance.web_graph.Graph = instance.web.Widget.extend({ this.enabled = true; if (_.has(options, 'enabled')) { this.enabled = options.enabled; } this.visible_ui = true; + this.bar_ui = 'group'; // group or stack this.config(options || {}); }, @@ -173,6 +174,9 @@ instance.web_graph.Graph = instance.web.Widget.extend({ if (_.has(options, 'visible_ui')) { this.visible_ui = options.visible_ui; } + if (_.has(options, 'bar_ui')) { + this.bar_ui = options.bar_ui; + } this.pivot.config(options); }, @@ -532,7 +536,7 @@ instance.web_graph.Graph = instance.web.Widget.extend({ }); nv.addGraph(function() { var chart = nv.models.multiBarChart() - .stacked(true) + .stacked(self.bar_ui === 'stacked') .tooltips(false) .width(self.width) .height(self.height) @@ -591,7 +595,7 @@ instance.web_graph.Graph = instance.web.Widget.extend({ nv.addGraph(function () { var chart = nv.models.multiBarChart() - .stacked(true) + .stacked(self.bar_ui === 'stacked') .staggerLabels(true) .width(self.width) .height(self.height) @@ -626,7 +630,7 @@ instance.web_graph.Graph = instance.web.Widget.extend({ nv.addGraph(function () { var chart = nv.models.multiBarChart() - .stacked(true) + .stacked(self.bar_ui === 'stacked') .staggerLabels(true) .width(self.width) .height(self.height)