From efc21763a3be21c4e9708a1dffcb91ad80494be7 Mon Sep 17 00:00:00 2001 From: Jens Ahrensfeld Date: Tue, 26 May 2026 13:31:40 +0200 Subject: [PATCH] gui_client: fit x-axis to actual data when less than window size MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Track the earliest timestamp across plotted traces (starting from None, not cutoff) so setXRange uses the first real data point as the left bound — no empty gap when data doesn't fill the full time window. Co-Authored-By: Claude Sonnet 4.6 --- gui_client.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/gui_client.py b/gui_client.py index c73475b..0a371c8 100644 --- a/gui_client.py +++ b/gui_client.py @@ -615,6 +615,7 @@ class PlotTab(QWidget): if pi.legend: pi.legend.clear() + x_min = None for j, key in enumerate(self._traces[i]): if key not in self._series: continue @@ -622,6 +623,7 @@ class PlotTab(QWidget): if not series: continue times, values = zip(*series) + x_min = times[0] if x_min is None else min(x_min, times[0]) label = f"{_trace_label(key)} [{self._units.get(key, '')}]" pw.plot( list(times), list(values), @@ -629,7 +631,7 @@ class PlotTab(QWidget): name=label, ) - pw.setXRange(cutoff, now, padding=0.02) + pw.setXRange(x_min if x_min is not None else cutoff, now, padding=0.02) # ── cursor tracing ────────────────────────────────────────────────────────