diff options
| author | Gery Debongnie <ged@openerp.com> | 2014-04-22 17:04:01 +0200 |
|---|---|---|
| committer | Gery Debongnie <ged@openerp.com> | 2014-04-22 17:04:01 +0200 |
| commit | 394897383fb0d6f278a89d5a7dffb7e74857a59c (patch) | |
| tree | 757d1a733efe7c5773851e3d2a9d0761506339ad /addons/web_graph/static/src/js/graph_widget.js | |
| parent | f584b030bc869277f8ae2573e125b347d579364c (diff) | |
[FIX] correct the scaling problem of graph bar charts: nvd3 needs a numeric value and was given a [value]. Also, improves the margin of bar/line/pie charts (addon web_graph)
bzr revid: ged@openerp.com-20140422150401-p0t9xmittp73j7hx
Diffstat (limited to 'addons/web_graph/static/src/js/graph_widget.js')
| -rw-r--r-- | addons/web_graph/static/src/js/graph_widget.js | 17 |
1 files changed, 6 insertions, 11 deletions
diff --git a/addons/web_graph/static/src/js/graph_widget.js b/addons/web_graph/static/src/js/graph_widget.js index 3d3c8b77513..1941047c437 100644 --- a/addons/web_graph/static/src/js/graph_widget.js +++ b/addons/web_graph/static/src/js/graph_widget.js @@ -611,7 +611,7 @@ openerp.web_graph.Graph = openerp.web.Widget.extend({ if ((dim_x === 0) && (dim_y === 0)) { data = [{key: _t('Total'), values:[{ x: _t('Total'), - y: this.pivot.get_total(), + y: this.pivot.get_total()[0], }]}]; // Only column groupbys } else if ((dim_x === 0) && (dim_y >= 1)){ @@ -624,7 +624,7 @@ openerp.web_graph.Graph = openerp.web.Widget.extend({ // Just 1 row groupby } else if ((dim_x === 1) && (dim_y === 0)) { data = _.map(this.pivot.main_row().children, function (pt) { - var value = self.pivot.get_total(pt), + var value = self.pivot.get_total(pt)[0], title = (pt.title !== undefined) ? pt.title : _t('Undefined'); return {x: title, y: value}; }); @@ -661,8 +661,6 @@ openerp.web_graph.Graph = openerp.web.Widget.extend({ nv.addGraph(function () { var chart = nv.models.multiBarChart() - .width(self.width) - .height(self.height) .reduceXTicks(false) .stacked(self.bar_ui === 'stack') .showControls(show_controls); @@ -705,10 +703,7 @@ openerp.web_graph.Graph = openerp.web.Widget.extend({ nv.addGraph(function () { var chart = nv.models.lineChart() - .x(function (d,u) { return u; }) - .width(self.width) - .height(self.height) - .margin({top: 30, right: 20, bottom: 20, left: 60}); + .x(function (d,u) { return u; }); d3.select(self.svg) .attr('width', self.width) @@ -730,14 +725,14 @@ openerp.web_graph.Graph = openerp.web.Widget.extend({ if (dim_x === 0) { title = self.measure_label; } - return {x: title, y: self.pivot.get_total(row)}; + return {x: title, y: self.pivot.get_total(row)[0]}; }); nv.addGraph(function () { var chart = nv.models.pieChart() - .color(d3.scale.category10().range()) .width(self.width) - .height(self.height); + .height(self.height) + .color(d3.scale.category10().range()); d3.select(self.svg) .datum(data) |
