[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
This commit is contained in:
Gery Debongnie 2013-11-28 15:51:55 +01:00
parent 8013a154b8
commit e2d2d51b7a
3 changed files with 7 additions and 4 deletions

View File

@ -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) {

View File

@ -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) {

View File

@ -60,8 +60,6 @@
</a>
</li>
</t>
<li class="divider"></li>
<li><a>Clear groups</a></li>
</ul>
</div>