From 49ba6feb3a8494336c5772a06e9569d611fc240a Mon Sep 17 00:00:00 2001 From: wyzula-jan <133381102+wyzula-jan@users.noreply.github.com> Date: Mon, 28 Aug 2023 17:56:00 +0200 Subject: [PATCH] feat: crosshair snapped to x, y data automatically, clicked coordinates glows --- bec_widgets/examples/oneplot/oneplot.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/bec_widgets/examples/oneplot/oneplot.py b/bec_widgets/examples/oneplot/oneplot.py index 8dd4028f..37fcdb38 100644 --- a/bec_widgets/examples/oneplot/oneplot.py +++ b/bec_widgets/examples/oneplot/oneplot.py @@ -17,6 +17,7 @@ from bec_lib.core import MessageEndpoints # - implement scanID database for visualizing previous scans # - multiple signals for different monitors # - user can choose what motor against what monitor to plot +# - crosshair snaps now just to fit, not to actual data class PlotApp(QWidget): @@ -38,6 +39,7 @@ class PlotApp(QWidget): self.init_ui() self.init_curves() + self.hook_crosshair() self.pushButton_hook.clicked.connect(self.hook_crosshair) @@ -80,15 +82,17 @@ class PlotApp(QWidget): # TODO hook signals # TODO hook crosshair - # self.hook_crosshair() + self.tableWidget_crosshair.setRowCount(len(self.monitor_names)) + self.tableWidget_crosshair.setVerticalHeaderLabels(self.monitor_names) + self.hook_crosshair() def hook_crosshair(self): - self.crosshair_1d = Crosshair(self.plot, precision=10) + self.crosshair_1d = Crosshair(self.plot, precision=3) self.crosshair_1d.coordinatesChanged1D.connect( lambda x, y: self.update_table(self.tableWidget_crosshair, x, y, column=0) ) - self.crosshair_1d.coordinatesChanged1D.connect( - lambda x, y: print(f"crosshair 1d x = {x}, y = {y}") + self.crosshair_1d.coordinatesClicked1D.connect( + lambda x, y: self.update_table(self.tableWidget_crosshair, x, y, column=1) ) def update_table(self, table_widget, x, y_values, column):