From c18256fe3dc7a4be1656eabd9f4acee4a2a7d8ea Mon Sep 17 00:00:00 2001 From: Xavier Morel Date: Wed, 28 Sep 2011 16:59:19 +0200 Subject: [PATCH] [FIX] field names in pie chart builder and link to other views in charts bzr revid: xmo@openerp.com-20110928145919-z4c7n550399kt8gt --- addons/web_graph/static/src/js/graph.js | 23 ++++++++--------------- 1 file changed, 8 insertions(+), 15 deletions(-) diff --git a/addons/web_graph/static/src/js/graph.js b/addons/web_graph/static/src/js/graph.js index 6255a74daa0..a6d2b4fbe89 100644 --- a/addons/web_graph/static/src/js/graph.js +++ b/addons/web_graph/static/src/js/graph.js @@ -291,14 +291,14 @@ openerp.web_graph.GraphView = openerp.web.View.extend({ var chart = new dhtmlXChart({ view:"pie3D", container:self.element_id+"-piechart", - value:"#"+self.operator_field+"#", + value:"#"+self.ordinate+"#", pieInnerText:function(obj) { - var sum = chart.sum("#"+self.operator_field+"#"); - var val = obj[self.operator_field] / sum * 100 ; + var sum = chart.sum("#"+self.ordinate+"#"); + var val = obj[self.ordinate] / sum * 100 ; return val.toFixed(1) + "%"; }, tooltip:{ - template:"#"+self.chart_info_fields+"#"+"="+"#"+self.operator_field+"#" + template:"#"+self.abscissa+"#"+"="+"#"+self.ordinate+"#" }, gradient:"3d", height: 20, @@ -313,9 +313,7 @@ openerp.web_graph.GraphView = openerp.web.View.extend({ width:12 }, template:function(obj){ - var val = obj[self.chart_info_fields]; - val = (typeof val == 'object')?val[1]:val; - return val; + return obj[self.abscissa] || 'Undefined'; } } }); @@ -329,18 +327,13 @@ openerp.web_graph.GraphView = openerp.web.View.extend({ if($(".dhx_tooltip").is(":visible")) { $(".dhx_tooltip").remove('div'); } - id = id[this.chart_info_fields]; + id = id[this.abscissa]; if (typeof id == 'object'){ id = id[0]; } - var record_id; - if (typeof this.chart_info_fields == 'object'){ - record_id = this.chart_info_fields[0]; - }else{ - record_id = this.chart_info_fields; - } - var modes = !!modes ? modes.split(",") : ["list", "form", "graph"]; + var record_id = this.abscissa; + var modes = ["list", "form", "graph"]; var views = []; _.each(modes, function(mode) { var view = [false, mode];