feat(graph): add graph tab for whole-run data

Provides a static line chart plotting multi-sensor temperature values
over time when a session file is loaded.
This commit is contained in:
jack
2026-07-10 20:06:48 -07:00
parent 94f917b116
commit 4bb855a940
8 changed files with 242 additions and 2 deletions
+45
View File
@@ -66,6 +66,51 @@ class TestUpdateTrend:
gv.updateTrend("[1, 2, 3]")
class TestUpdateChart:
def test_plots_one_series_per_sensor(self):
from pygui.backend.visualization.graph_view import GraphView
gv = GraphView()
gv._plot_widget = _make_plot_widget()
series = [[150.0, 151.0, 152.0], [148.5, 148.4, 148.6]]
gv.updateChart("Sensor 1,Sensor 2", json.dumps(series))
assert gv._plot_widget.clear.called
assert gv._plot_widget.plot.call_count == 2
assert gv._sensor_names == ["Sensor 1", "Sensor 2"]
def test_rejects_invalid_json(self):
from pygui.backend.visualization.graph_view import GraphView
gv = GraphView()
gv._plot_widget = _make_plot_widget()
gv.updateChart("Sensor 1", "not json")
assert not gv._plot_widget.plot.called
def test_empty_series_clears_without_plotting(self):
from pygui.backend.visualization.graph_view import GraphView
gv = GraphView()
gv._plot_widget = _make_plot_widget()
gv.updateChart("", "[]")
assert gv._plot_widget.clear.called
assert not gv._plot_widget.plot.called
def test_no_plot_widget(self):
from pygui.backend.visualization.graph_view import GraphView
gv = GraphView()
assert gv._plot_widget is None
# Should not crash
gv.updateChart("Sensor 1", json.dumps([[1.0, 2.0]]))
class TestUpdateComparison:
def test_parses_valid_json(self):
from pygui.backend.visualization.graph_view import GraphView