diff options
| author | Gery Debongnie <ged@openerp.com> | 2013-11-28 15:51:55 +0100 |
|---|---|---|
| committer | Gery Debongnie <ged@openerp.com> | 2013-11-28 15:51:55 +0100 |
| commit | e2d2d51b7a7e9a77cb8b89e4adee35763e61201a (patch) | |
| tree | f90f2485e37425f6853538b746e02d214d8a4776 /addons/web_graph/static/src/js | |
| parent | 8013a154b80766779cbe2cbad101bc3669e0e41f (diff) | |
[IMP] supports the attribute 'type' in the xml definition of the graph view, at least for bar_charts (addon web_graph)
bzr revid: ged@openerp.com-20131128145155-b5w4fhw9vrp9txuc
Diffstat (limited to 'addons/web_graph/static/src/js')
| -rw-r--r-- | addons/web_graph/static/src/js/charts.js | 5 | ||||
| -rw-r--r-- | addons/web_graph/static/src/js/graph.js | 4 |
2 files changed, 7 insertions, 2 deletions
diff --git a/addons/web_graph/static/src/js/charts.js b/addons/web_graph/static/src/js/charts.js index 2ac84085ce1..35585c73c09 100644 --- a/addons/web_graph/static/src/js/charts.js +++ b/addons/web_graph/static/src/js/charts.js @@ -2,8 +2,9 @@ openerp.web_graph.draw_chart = function (mode, pivot, svg) { var data = _.map(pivot.rows.main.children, function (pt) { - var val = pivot.get_value(pt.id, pivot.cols.main.id); - return {x: pt.title, y: val}; + var value = pivot.get_value(pt.id, pivot.cols.main.id), + title = (pt.title !== undefined) ? pt.title : 'Undefined'; + return {x: title, y: value}; }); switch (mode) { diff --git a/addons/web_graph/static/src/js/graph.js b/addons/web_graph/static/src/js/graph.js index 450a86a470a..77f444948b5 100644 --- a/addons/web_graph/static/src/js/graph.js +++ b/addons/web_graph/static/src/js/graph.js @@ -122,6 +122,10 @@ instance.web_graph.GraphView = instance.web.View.extend({ model = new instance.web.Model(fields_view_get.model, {group_by_no_leaf: true}), row_groupby = []; + if (fields_view_get.arch.attrs.type === 'bar') { + this.mode = 'bar_chart'; + } + // get the default groupbys and measure defined in the field view _.each(fields_view_get.arch.children, function (field) { if ('name' in field.attrs) { |
