[FIX] web: error if chart with only zero values

We could get an js error if the chart contained zero values.

opw-703245
This commit is contained in:
Nicolas Lempereur
2017-01-02 17:31:06 +01:00
parent 983237a53c
commit a988653157
@@ -205,18 +205,20 @@ return Widget.extend({
all_zero = all_zero && (datapt.value === 0);
});
if (some_negative && !all_negative) {
return this.$el.append(QWeb.render('GraphView.error', {
this.$el.append(QWeb.render('GraphView.error', {
title: _t("Invalid data"),
description: _t("Pie chart cannot mix positive and negative numbers. " +
"Try to change your domain to only display positive results"),
}));
return;
}
if (all_zero) {
return this.$el.append(QWeb.render('GraphView.error', {
this.$el.append(QWeb.render('GraphView.error', {
title: _t("Invalid data"),
description: _t("Pie chart cannot display all zero numbers.. " +
"Try to change your domain to display positive results"),
}));
return;
}
if (this.groupbys.length) {
data = this.data.map(function (datapt) {