From 4dc4ede1d251d081e5bcf3d37fcc784982c9258e Mon Sep 17 00:00:00 2001 From: wyzula-jan Date: Tue, 29 Jul 2025 15:52:37 +0200 Subject: [PATCH] fix(plot_base): crosshair items are excluded from visible curves and from auto_range --- bec_widgets/widgets/plots/plot_base.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/bec_widgets/widgets/plots/plot_base.py b/bec_widgets/widgets/plots/plot_base.py index 5e635a1f..1e112ed7 100644 --- a/bec_widgets/widgets/plots/plot_base.py +++ b/bec_widgets/widgets/plots/plot_base.py @@ -896,7 +896,18 @@ class PlotBase(BECWidget, QWidget): @property def visible_items(self): - return [item for item in self.plot_item.items if item.isVisible()] + crosshair_items = [] + if self.crosshair: + crosshair_items = [ + self.crosshair.v_line, + self.crosshair.h_line, + self.crosshair.coord_label, + ] + return [ + item + for item in self.plot_item.items + if item.isVisible() and item not in crosshair_items + ] def _apply_autorange_only_visible_curves(self): """ @@ -906,6 +917,7 @@ class PlotBase(BECWidget, QWidget): curves (list): List of curves to apply autorange to. """ visible_items = self.visible_items + self.plot_item.autoRange(items=visible_items if visible_items else None) @SafeProperty(int, doc="The font size of the legend font.")