gui_client: clear plot data on connect/reconnect

Add PlotTab.clear_data() which resets _series and _units, then redraws.
Called in MainWindow._connect() before opening the socket so stale data
from a previous session never mingles with fresh history from the server.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-05-26 13:36:26 +02:00
co-authored by Claude Sonnet 4.6
parent efc21763a3
commit 89810ce95b
+7 -1
View File
@@ -518,7 +518,12 @@ class PlotTab(QWidget):
for j, key in enumerate(self._traces[plot_idx]):
self._add_chip(plot_idx, key, j)
# ── public update called on every new snapshot ────────────────────────────
# ── public API ────────────────────────────────────────────────────────────
def clear_data(self):
self._series.clear()
self._units.clear()
self._redraw()
def update(self, snapshot: dict):
ts_raw = snapshot.get("ts", "")
@@ -680,6 +685,7 @@ class MainWindow(QMainWindow):
self._record_count = 0
def _connect(self, host: str, port: int):
self._plot.clear_data()
err = self._reader.connect_to(host, port)
if err:
self._connector.set_disconnected(err)