Hi,
I am a novice at pyqtgraph. I would like to add a TickSliderItem to the vertical axis of a plot that I can move up and down. I am making a DIY oscilloscope GUI and would like to use a slider to indicate the trigger point. The only example I see on the web that uses TickSliderItem uses it with GradientEditorItem and "attaches" it with setCentralItem(), but I can't figure out what I would use to attach it to the y scale of a plot. Can anyone help me with this?
The following is an extract of one of the examples, with "ts" being TickSliderItem that I somehow need to attach:
import numpy as np
import pyqtgraph as pg
from pyqtgraph.Qt import QtGui, QtCore
from pyqtgraph.Point import Point
#generate layout
app = QtGui.QApplication([])
win = pg.GraphicsWindow()
win.setWindowTitle('pyqtgraph example: crosshair')
label = pg.LabelItem(justify='right')
win.addItem(label)
p2 = win.addPlot(row=1, col=0)
ts = pg.TickSliderItem()
#view.setCentralItem(ts)
ts.addTick(0.5, 'r')
#create numpy arrays
#make the numbers large to show that the xrange shows data from 10000 to all the way 0
data1 = 10000 + 15000 * pg.gaussianFilter(np.random.random(size=10000), 10) + 3000 * np.random.random(size=10000)
p2.plot(data1, pen="w")
## Start Qt event loop unless running in interactive mode or using pyside.
if __name__ == '__main__':
import sys
if (sys.flags.interactive != 1) or not hasattr(QtCore, 'PYQT_VERSION'):
QtGui.QApplication.instance().exec_()
Regards,
Blake