[FIX] web: display selection label in graph

When grouping a graph view by a selection field, the labels on x axis
were the selection values themselves (not their corresponding label).

This issue was only present if there was only one group by field. In
this case, the attribute `grouped_on` is not an array but a string
containing the field name. This case wasn't correctly handled.

Note that this issue is not present in the new views (from saas-16).

Closes #19790
This commit is contained in:
Martin Geubelle
2017-11-27 15:47:35 +01:00
parent 10de33a57e
commit ccaced9292
@@ -66,7 +66,8 @@ return Widget.extend({
values = [];
if (this.groupbys.length === 1) data_pt.value = [data_pt.value];
for (j = 0; j < data_pt.value.length; j++) {
values[j] = this.sanitize_value(data_pt.value[j], data_pt.grouped_on[j]);
var field = _.isArray(data_pt.grouped_on) ? data_pt.grouped_on[j] : data_pt.grouped_on;
values[j] = this.sanitize_value(data_pt.value[j], field);
}
value = is_count ? data_pt.length : data_pt.aggregates[this.measure];
this.data.push({