Commit 3b2caad9 authored by Jameson Rollins's avatar Jameson Rollins
Browse files

Merge branch 'ylog_patch' into 'ylog'

Temporary patch to address the enabling of autoscaling on the X axis.

See merge request !2
parents eb55a61c dade2193
Pipeline #399343 passed with stage
in 2 minutes and 51 seconds
......@@ -20,7 +20,7 @@ class AxisCtrlMenu(QtWidgets.QMenu, AxisCtrlTemplate):
self.maxText.editingFinished.connect(mainmenu.yRangeTextChanged)
self.autoRadio.clicked.connect(mainmenu.yAutoClicked)
self.autoPercentSpin.valueChanged.connect(mainmenu.yAutoSpinChanged)
self.logModeCheck.toggled.connect(mainmenu.yLogModeToggled)
self.logModeCheck.stateChanged.connect(mainmenu.yLogModeToggled)
# this is lifted from the pqtgraph.ViewBoxMenu module
......@@ -331,6 +331,14 @@ class NDScopePlotMenu(QtWidgets.QMenu):
def yInvertToggled(self, b):
self.view().invertY(b)
def yLogModeToggled(self, b):
self.view().enableAutoRange(self.view().XAxis, False)
self.plot().setLogMode(y=True)
def yLogModeToggled(self, state):
# FIXME: This is a hack around https://github.com/pyqtgraph/pyqtgraph/issues/2307
# Since we can not stop it from autoscaling the X range at least once, we keep track of
# what the X range was before the autoscale and set it back to that.
x_range = self.plot().getViewBox().viewRange()[0]
if state == QtCore.Qt.Checked:
self.plot().setLogMode(x=False, y=True)
else:
self.plot().setLogMode(x=False, y=False)
self.view().disableAutoRange(self.view().XAxis)
self.plot().getViewBox().setXRange(min=x_range[0], max=x_range[1], padding=0.0)
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment