Hi,

Just a thought, all the functionality you want can be provided by an 
InfiniteLine, you just want the level to be indicated with a 
triangle/marker on the axis rather than a line across the plot. So maybe 
copy the code from InfiniteLine as a base, but modify the bounding box and 
paint methods etc to draw the marker instead. You could probably also cut 
out a lot of the other functionality you don't need to simplify it a bit.

Patrick

On Saturday, 7 September 2019 00:43:14 UTC+9:30, blake nusbickel wrote:
>
> 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
>

-- 
You received this message because you are subscribed to the Google Groups 
"pyqtgraph" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/pyqtgraph/cec7cfd3-4146-4f3d-8ade-f48b44ad6abb%40googlegroups.com.

Reply via email to