Example Code

Zooming into a Graph with the mouse wheel

Code and Documents

Attachment

I've often plotted things on a LabVIEW graph and needed to zoom into a particular section to see it in more detail. NI provides several tools with the graph palette to do this. However, there isn't anything that natively uses the mouse wheel.

Using a simple event case I've created a way to use the mouse wheel to zoom in and out of any part of the graph. Run the code and then hold the mouse over the section of graph you would like to zoom into and then rotate your mouse wheel to zoom in or out into that section. The example code displays 200 random points on screen. I used LabVIEW 2014. I'm not sure which verstion of labVIEW introduced the mouse wheel event. Hope you find this useful.

Please note for those using Parallels: uncheck Parallels Desktop mouse option (Enable smooth scrolling)

Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.

Comments
X.
Trusted Enthusiast
Trusted Enthusiast
on

Does it work for anyone? I never used the mouse wheel event so far, but I was interested by the idea, so I checked this example.

I do get the mouse coordinates but the Delta parameter is stuck to zero, so obviously nothing is done.

I am running LabVIEW 2015 in a Windows virtual machine though, so it might well be an integration issue with Parallels Desktop (it wouldn't be the first one). Just checking...

M.Lichtenheld
Member
Member
on

Works fine. Usefull feature. Specially for producer/consumer frameworks.

Please add the function for the y axis.

Thanks.

AMyth
Member
Member
on

Most folks only have one scroll wheel so adding zoom for Y will need some sort of modifier key like Shift or Ctrl. There is a cluster called Platmods in the event structure that you can tap into and change the code accordingly. I did not protect the block diagram so people could make modifications.

X.
Trusted Enthusiast
Trusted Enthusiast
on

OK, I figured what the issue was (with the help of NI support): a simple Parallels Desktop mouse option (Enable smooth scrolling) to uncheck.

AMyth
Member
Member
on

Thanks for posting back!

techgineer
Member
Member
on

This is an old thread but I thought this info could still be useful:

 

The event item "Orientation" shows whether the user is swiping vertically or horizontally when using trackpad scrolling on a Mac. I modified this VI to use it to allow zooming in either X or Y.

 

Thanks for the original example, AMyth!

Contributors