pyqtgraph ViewBox(0.9.9) setLimit do not keep the aspect locked:

682 views
Skip to first unread message

Manish

unread,
May 16, 2014, 5:51:43 AM5/16/14
to pyqt...@googlegroups.com
Hi Luke,
 
I have to prevent zoom out and panning in the Viewbox under following circumstances.
1. There should not be any zooming out.
2. Aspect ratio should be locked to 1:1.
3. viewbox height and width can change.
 
I replaced the Viewbox 0.9.8 with Viewbox 0.9.9 in my sitepackage to check wheather it works properly or not. I set the limits after wihich zooming out should be disabled as the original x and y limit.
But when the the width of the viewbox is changed keeping the height constant then the aspect ratio of the graph change. I think since the x range does not change resizing when the height is fixed, hence the aspect ratio is not maintained as 1:1.
 
Please provide your views and idea to solve this problem.
 
Thanks

Luke Campagnola

unread,
May 16, 2014, 11:14:43 AM5/16/14
to pyqt...@googlegroups.com
Hi Manish,

There is currently a bug in ViewBox that causes the view limits to override the aspect ratio. I hope to have this fixed soon.
However: If you want to disable zooming entirely, then the best way to do this is with ViewBox.setMouseEnabled(x=False, y=False). You should find that this does interact correctly with the aspect ratio constraint, even when resizing the window.


Luke

Manish

unread,
May 20, 2014, 6:05:01 AM5/20/14
to pyqt...@googlegroups.com
Thanks for your reply Luke.
I have to disable zoom in and zoom out after a certain limit at the same time aspect ratio needs to locked. I have tried couple of things on resize event like storing viewbox target range on resize event and setting that as the original  x-y range and comparing a percentage of that on rangeChanged event. It works for some of the cases but fails when i resize the window under zoomed in state.

Manu

unread,
Feb 11, 2020, 10:42:33 AM2/11/20
to pyqtgraph
Hi, this issue is still present. When using setLimits on a viewBox (contains an image in my case), the aspect ration is not conserved, which is very annoying. Or is there something I'm missing?

Israel Brewster

unread,
Feb 11, 2020, 11:07:18 AM2/11/20
to pyqt...@googlegroups.com
I submitted a pull request with a fix for this some time ago, but unfortunately it has not been reviewed or merged as of yet. Hopefully soon. 

Sent from my iPhone

On Feb 11, 2020, at 6:42 AM, Manu <emmanue...@gmail.com> wrote:


Hi, this issue is still present. When using setLimits on a viewBox (contains an image in my case), the aspect ration is not conserved, which is very annoying. Or is there something I'm missing?

--
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 pyqtgraph+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pyqtgraph/702418de-5c53-4c87-8cd4-cb1ac051adff%40googlegroups.com.

Manu

unread,
Feb 12, 2020, 11:28:03 AM2/12/20
to pyqt...@googlegroups.com
Thanks for the info! Have a good evening

Reply all
Reply to author
Forward
0 new messages