From d45dbd0cc26a0a4b5dbe4649ce3fbac895376c0a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Tue, 16 Feb 2021 22:38:16 +0100 Subject: [PATCH] Support sparse data in y's graph with domain The value when the domain skip the record should be undefined so the graph has no point at this ordinate. issue10072 review337561002 --- tryton/gui/window/view_form/view/graph_gtk/graph.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tryton/gui/window/view_form/view/graph_gtk/graph.py b/tryton/gui/window/view_form/view/graph_gtk/graph.py index a854d30ac3..370286739a 100644 --- a/tryton/gui/window/view_form/view/graph_gtk/graph.py +++ b/tryton/gui/window/view_form/view/graph_gtk/graph.py @@ -370,7 +370,6 @@ class Graph(Gtk.DrawingArea): self.datas.setdefault(x, {}) for yfield in self.yfields: key = yfield.get('key', yfield['name']) - self.datas[x].setdefault(key, 0.0) if yfield.get('domain'): context = rpc.CONTEXT.copy() context['context'] = context.copy() @@ -379,6 +378,7 @@ class Graph(Gtk.DrawingArea): context[field] = model[field].get(model) if not PYSONDecoder(context).decode(yfield['domain']): continue + self.datas[x].setdefault(key, 0.0) if yfield['name'] == '#': self.datas[x][key] += 1 else: