From eeb6134287b9fe1866ba9b7a6c18a2d5560b4562 Mon Sep 17 00:00:00 2001 From: Ferran Capallera Date: Thu, 1 Oct 2026 14:44:14 +0200 Subject: [PATCH 1/2] fix: avoid raising on empty final_data --- ooui/graph/chart.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ooui/graph/chart.py b/ooui/graph/chart.py index b1a0aa8..8c85172 100644 --- a/ooui/graph/chart.py +++ b/ooui/graph/chart.py @@ -185,7 +185,7 @@ def process(self, values, fields, options=None): if ((self.type == 'line' and self.y_range) or (self.type == 'bar' and self.y_range == 'slider')): y_axis_opts = {'mode': self.y_range} - if self.y_range == 'auto': + if self.y_range == 'auto' and final_data: y_axis_opts['valueOpts'] = get_min_max(final_data) result['yAxisOpts'] = y_axis_opts From 722d19bd29fcb97ddecf95e036ab0a520d381bfb Mon Sep 17 00:00:00 2001 From: GISCE Bot Date: Thu, 1 Oct 2026 15:20:39 +0200 Subject: [PATCH 2/2] test: cover auto y range without data Co-authored-by: fcapallera <36483261+fcapallera@users.noreply.github.com> --- spec/graph/graph_spec.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/spec/graph/graph_spec.py b/spec/graph/graph_spec.py index c1c297b..c3c5dcf 100644 --- a/spec/graph/graph_spec.py +++ b/spec/graph/graph_spec.py @@ -186,6 +186,20 @@ 'max': 32 } })) + + with it("should return empty data without value limits when there are no values"): + xml = """ + + + + + """ + graph = parse_graph(xml) + fields = {'date': {'type': 'date'}, 'v': {'type': 'integer'}} + result = graph.process([], fields) + expect(result['data']).to(equal([])) + expect(result['yAxisOpts']).to(equal({'mode': 'auto'})) + with description("A line graph with y_range to full"): with it("should return yAxisOpts to the result with mode full"): xml = """