make y range dynamic based on data range of plot within viewbox

47 views
Skip to first unread message

Kane Hill

unread,
May 3, 2017, 5:52:19 PM5/3/17
to pyqtgraph
Hi All,

I would like to change the behaviour of the viewbox when zooming with the wheel. The behaviour of the x axis should be the same as normal, but everytime the wheel moves and the scene changes the viewable y range needs to be set to the range of the extremes (min, max) within the dataset. I am using the candlestick example to plot data. In reference to the following data. Let's say we zoom so that the x values 4-7 are visible, then y axis should be zoomed (with some padding) - low = 15, hi = 26


x = 1,2,3,4,5,6,7,8,9,10
lo = 10,15,11,16,20,18,25,26,29,33
hi = 13,21,13,22,25,23,31,34,36,40

I assume we would need to detect that the view has been changed via something like I a

vb.sigResized.connect

method and then sub class

vb.setYRange

I hope it's clear.

Thanks in advance

Kane
Reply all
Reply to author
Forward
0 new messages