View Full Version : Point-and-Click Zooming Possible in Wave GUI?

10-05-2011, 07:42 AM
I've built a PV-Wave GUI in which I create and display 2D, time-series plots in the drawing area. Now let's say the time series spans a month, but I want to see only one day of it. Is there a way I can, using the mouse to specify a new time (x-axis) range, change the display to show only that time span?

Ideally, I'd like to have the ability to click and drag the mouse to define not only a new x-axis range but a new y-axis range as well; in other words, click and drag to define a box and display only the contents of that box.

Is any of this possible?


10-10-2011, 09:02 AM
Hi solargus,

Yes, this is very possible, and quite common. You use WtAddHandler to set up an event handler to capture and track the mouse events that define the box region of interest. Once you have the new zoom location (or rubber band box, region of interest) from the user, you do a little coordinate conversion, and then you re-draw the data using the new axis ranges (both X and Y) that come out of the coordinate conversions. Most people use CONVERT_COORD but there are other routines and techniques.

Take a look at the file WwZoomDraw.pro, in <WAVE_DIR>/lib/user/guitools, where WAVE_DIR is the top level directory of your local PV-WAVE installation. You might be able to use this User Library routine as is, and if not, it at least shows you how to do the rubber band box. This routine does the coordinate conversions on it's own; the author knew the math involved and did not make use of the other convience routines available within PV-WAVE.

Hope this helps,

Don B.