diff options
| author | mikel <mikel@pcl2> | 2012-02-15 10:46:14 +0100 |
|---|---|---|
| committer | mikel <mikel@pcl2> | 2012-02-15 10:46:14 +0100 |
| commit | 79f4e01eaaabdea0ea784d52db8e05e984ad5a4d (patch) | |
| tree | ffb193234842be792d642805ee3fabb5d249e942 /addons/web_graph/static/src | |
| parent | 112070a58f174eedfca08a046423989e7bca3b0f (diff) | |
| parent | 99f01e1df25fb468828a0436e0bc7c03bcf07394 (diff) | |
Suggested fix
bzr revid: mikel@pcl2-20120215094614-uzbqxiuemq6iu3f9
Diffstat (limited to 'addons/web_graph/static/src')
| -rw-r--r-- | addons/web_graph/static/src/js/graph.js | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/addons/web_graph/static/src/js/graph.js b/addons/web_graph/static/src/js/graph.js index 124c339457d..515d57677ed 100644 --- a/addons/web_graph/static/src/js/graph.js +++ b/addons/web_graph/static/src/js/graph.js @@ -216,9 +216,11 @@ openerp.web_graph.GraphView = openerp.web.View.extend({ .pluck(this.group_field) .uniq() .map(function (value, index) { + if(value) { + value = value.toLowerCase().replace(/[\s\/]+/g,'_'); + } return { - group: self.ordinate + '_' + - value.toLowerCase().replace(/[\s\/]+/g,'_'), + group: _.str.sprintf('%s_%s', self.ordinate, value), text: value, color: COLOR_PALETTE[index % COLOR_PALETTE.length] }; @@ -231,9 +233,11 @@ openerp.web_graph.GraphView = openerp.web.View.extend({ // second argument is coerced to a str, no good for boolean r[self.abscissa] = records[0][self.abscissa]; _(records).each(function (record) { - var key = _.str.sprintf('%s_%s', - self.ordinate, - record[self.group_field].toLowerCase().replace(/[\s\/]+/g,'_')); + var value = record[self.group_field]; + if(value) { + record[self.group_field] = value.toLowerCase().replace(/[\s\/]+/g,'_'); + } + var key = _.str.sprintf('%s_%s', self.ordinate, value); r[key] = record[self.ordinate]; }); return r; @@ -349,7 +353,7 @@ openerp.web_graph.GraphView = openerp.web.View.extend({ self.renderer = null; var chart = new dhtmlXChart({ view:"pie3D", - container:self.element_id+"-piechart", + container:self.widget_parent.element_id+"-piechart", value:"#"+self.ordinate+"#", pieInnerText:function(obj) { var sum = chart.sum("#"+self.ordinate+"#"); |
