diff --git a/bec_widgets/widgets/figure/plots/waveform/waveform.py b/bec_widgets/widgets/figure/plots/waveform/waveform.py index 2f1b27b6..52f2754c 100644 --- a/bec_widgets/widgets/figure/plots/waveform/waveform.py +++ b/bec_widgets/widgets/figure/plots/waveform/waveform.py @@ -396,7 +396,7 @@ class BECWaveform(BECPlotBase): Returns: BECCurve: The curve object. """ - curve = BECCurve(config=config, name=name, parent_item=self.plot_item) + curve = BECCurve(config=config, name=name, parent_item=self) self._curves_data[source][name] = curve self.plot_item.addItem(curve) self.config.curves[name] = curve.config diff --git a/bec_widgets/widgets/figure/plots/waveform/waveform_curve.py b/bec_widgets/widgets/figure/plots/waveform/waveform_curve.py index e9daf22f..3d8979a5 100644 --- a/bec_widgets/widgets/figure/plots/waveform/waveform_curve.py +++ b/bec_widgets/widgets/figure/plots/waveform/waveform_curve.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import Any, Literal, Optional +from typing import TYPE_CHECKING, Any, Literal, Optional import pyqtgraph as pg from pydantic import BaseModel, Field, field_validator @@ -9,6 +9,9 @@ from qtpy import QtCore from bec_widgets.utils import BECConnector, ConnectionConfig +if TYPE_CHECKING: + from bec_widgets.widgets.figure.plots.waveform import BECWaveform1D + class SignalData(BaseModel): """The data configuration of a signal in the 1D waveform widget for x and y axis.""" @@ -84,7 +87,7 @@ class BECCurve(BECConnector, pg.PlotDataItem): name: Optional[str] = None, config: Optional[CurveConfig] = None, gui_id: Optional[str] = None, - parent_item: Optional[pg.PlotItem] = None, + parent_item: Optional[BECWaveform1D] = None, **kwargs, ): if config is None: @@ -230,6 +233,7 @@ class BECCurve(BECConnector, pg.PlotDataItem): """ self.config.color_map_z = colormap self.apply_config() + self.parent_item.scan_history(-1) def get_data(self) -> tuple[np.ndarray, np.ndarray]: """