summaryrefslogtreecommitdiff
path: root/addons/web_graph/static/src/js
diff options
context:
space:
mode:
authorGery Debongnie <ged@openerp.com>2014-01-03 15:44:18 +0100
committerGery Debongnie <ged@openerp.com>2014-01-03 15:44:18 +0100
commit47762dfca2c49a8da9f9fd1b57f966a27d96f602 (patch)
tree69f48cce60d429ef8d7e9f63f1f58546135eac35 /addons/web_graph/static/src/js
parent64775d40988ebff185a01797ac502e2ca12167bf (diff)
[IMP] allows the selection of multiple measures in graph view (addon web_graph)
bzr revid: ged@openerp.com-20140103144418-7mstnfwah6v6jkkx
Diffstat (limited to 'addons/web_graph/static/src/js')
-rw-r--r--addons/web_graph/static/src/js/graph.js8
-rw-r--r--addons/web_graph/static/src/js/pivot.js8
2 files changed, 14 insertions, 2 deletions
diff --git a/addons/web_graph/static/src/js/graph.js b/addons/web_graph/static/src/js/graph.js
index 93cac5146ec..e8e4e561ef4 100644
--- a/addons/web_graph/static/src/js/graph.js
+++ b/addons/web_graph/static/src/js/graph.js
@@ -344,7 +344,7 @@ instance.web_graph.Graph = instance.web.Widget.extend({
measure_selection: function (event) {
event.preventDefault();
var measure = event.target.attributes['data-choice'].nodeValue;
- this.pivot.config({measures:[measure]});
+ this.pivot.config({toggle_measure:measure});
},
option_selection: function (event) {
@@ -421,7 +421,11 @@ instance.web_graph.Graph = instance.web.Widget.extend({
******************************************************************************/
draw_table: function () {
this.pivot.rows.main.title = 'Total';
- this.pivot.cols.main.title = this.title;
+ if (this.pivot.measures.length == 1) {
+ this.pivot.cols.main.title = this.measure_label(this.pivot.measures[0]);
+ } else {
+ this.pivot.cols.main.title = this.title;
+ }
this.draw_top_headers();
_.each(this.pivot.rows.headers, this.proxy('draw_row'));
},
diff --git a/addons/web_graph/static/src/js/pivot.js b/addons/web_graph/static/src/js/pivot.js
index 4e1359339dd..e112082e018 100644
--- a/addons/web_graph/static/src/js/pivot.js
+++ b/addons/web_graph/static/src/js/pivot.js
@@ -51,6 +51,14 @@ openerp.web_graph.PivotTable = openerp.web.Class.extend(openerp.EventDispatcherM
this.measures = options.measures;
changed = true;
}
+ if (options.toggle_measure) {
+ if (_.contains(this.measures, options.toggle_measure)) {
+ this.measures = _.without(this.measures, options.toggle_measure);
+ } else {
+ this.measures.push(options.toggle_measure);
+ }
+ changed = true;
+ }
if (!_.isEqual(options.col_groupby, this.cols.groupby)) {
this.cols.groupby = options.col_groupby;
changed = true;