From fa00ff97be5429f2d3fb43a28a8d4eb38e25f4c5 Mon Sep 17 00:00:00 2001 From: Priyanka Kakadiya Date: Tue, 21 Apr 2020 12:27:53 +0000 Subject: [IMP] web: graph: add bar/line chart sorting PURPOSE Currently, reporting views such as the bar and line charts have their x-axis sorted either alphabetically or according to a sequence. When reporting, the user would be interested in sorting the x-axis values by their measure. SPECIFICATIONS Add 'ascending' and 'descending' options in graph view for bar and line charts Task 2070103 closes odoo/odoo#49970 Signed-off-by: Aaron Bohy (aab) Co-authored-by: Mohammed Shekha --- addons/web/static/src/js/views/graph/graph_model.js | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'addons/web/static/src/js/views/graph/graph_model.js') diff --git a/addons/web/static/src/js/views/graph/graph_model.js b/addons/web/static/src/js/views/graph/graph_model.js index e1411324c77..6ee4d06651e 100644 --- a/addons/web/static/src/js/views/graph/graph_model.js +++ b/addons/web/static/src/js/views/graph/graph_model.js @@ -72,6 +72,7 @@ return AbstractModel.extend({ origins: [], stacked: params.stacked, timeRanges: params.timeRanges, + orderBy: params.orderBy }); this._computeDerivedParams(); @@ -126,6 +127,10 @@ return AbstractModel.extend({ this.chart.stacked = params.stacked; return Promise.resolve(); } + if ('orderBy' in params) { + this.chart.orderBy = params.orderBy; + return Promise.resolve(); + } return this._loadGraph(); }, -- cgit v1.2.3