diff --git a/gui_client.py b/gui_client.py index 2bbe935..3985340 100644 --- a/gui_client.py +++ b/gui_client.py @@ -390,6 +390,16 @@ class TimeAxisItem(pg.AxisItem): return [datetime.fromtimestamp(v).strftime("%H:%M:%S") for v in values] +class PlotViewBox(pg.ViewBox): + """ViewBox with axis-selective wheel zoom: plain wheel → X, Shift+wheel → Y.""" + def wheelEvent(self, ev, axis=None): + if ev.modifiers() & Qt.ShiftModifier: + axis = 1 # Y only + else: + axis = 0 # X only + super().wheelEvent(ev, axis=axis) + + class PlotTooltip(QWidget): """Floating value readout that follows the crosshair cursor.""" def __init__(self, parent: QWidget): @@ -523,6 +533,7 @@ class PlotTab(QWidget): pw = pg.PlotWidget( background="#12121e", axisItems={"bottom": TimeAxisItem(orientation="bottom")}, + viewBox=PlotViewBox(), ) pw.showGrid(x=True, y=True, alpha=0.3) pw.addLegend(offset=(0, 0), labelTextSize="8pt")