From ce6e66cef930a30d9a62988a16f9f8319cb9f25c Mon Sep 17 00:00:00 2001 From: Nicolas Lempereur Date: Thu, 24 Jan 2019 15:59:20 +0000 Subject: [FIX] web: bar chart no crazy with 2 group by In 3d2ca8104e4 some change were introduced to the graph view. But part of it had no sense when displaying data over 2 group by. eg. if the first level has 2 groups (2018, 2019) and each second level 2 groups (Done,Cancelled), we could have: 2018/Done: 0 2018/Cancelled: 5 2019/Done: 8 2019/Cancelled: 9 this gives us two main groups [2018: 5] / [2019: 17], the code remove the 2018 because [2018/Done] is 0 so we have something odd with columns not in order, and in stacked bar chart some part of a bar at the wrong offset opw-1932517 closes #30529 --- addons/web/static/src/js/views/graph/graph_renderer.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'addons/web/static/src/js/views/graph/graph_renderer.js') diff --git a/addons/web/static/src/js/views/graph/graph_renderer.js b/addons/web/static/src/js/views/graph/graph_renderer.js index 5ec89635dc8..2771159ab19 100644 --- a/addons/web/static/src/js/views/graph/graph_renderer.js +++ b/addons/web/static/src/js/views/graph/graph_renderer.js @@ -193,10 +193,12 @@ return AbstractRenderer.extend({ } } - // For Bar chart View, we keep only groups where count > 0 - data[0].values = _.filter(data[0].values, function (elem, index) { - return self.state.data[index].count > 0; - }); + // For one level Bar chart View, we keep only groups where count > 0 + if (this.state.groupedBy.length <= 1) { + data[0].values = _.filter(data[0].values, function (elem, index) { + return self.state.data[index].count > 0; + }); + } var $svgContainer = $('
', {class: 'o_graph_svg_container'}); this.$el.append($svgContainer); -- cgit v1.2.3