Solution
LabWindows/CVI does offer the capabilities of zooming and panning on graph controls.
Zooming gives you the ability to expand or contract the viewport around a particular point or area in a graph control. When you zoom in, the logical area contained in the viewport gets smaller, showing the area with more resolution. When you zoom out, the viewport shows a wider area. You can also use panning, which is the ability to shift the viewport.
By default, zooming and panning are disabled. To enable zooming and panning in a graph control, set the graph control to a mode other than indicator. You should then set one of the following available zooming modes through the Edit Graph dialog box or programmatically:
- If you set Zoom Style to Zoom to Rectangle in the Edit Graph dialog box or set the ATTR_ZOOM_STYLE control attribute to VAL_ZOOM_TO_RECT, users can define a rectangular zone that will become the new limits of the graph. To select these bounds, press <Ctrl> and click and hold the left mouse button to define the first corner of the box. Drag the mouse to define the opposite corner of the rectangle. When you are satisfied with the new boundaries of the graph, release the mouse button.
- If you set Zoom Style to X-Zoom or Y-Zoom in the Edit Graph dialog box or set the ATTR_ZOOM_STYLE control attribute to VAL_ZOOM_XAXIS or VAL_ZOOM_YAXIS, users can zoom along a single axis. Select a rectangle as you do with Zoom to Rectangle and within this zone the view will zoom in along the specified axis.
- If you set Zoom Style to Zoom Around Point in the Edit Graph dialog box or set the ATTR_ZOOM_STYLE control attribute to VAL_ZOOM_AROUND_PT, users can select a point around which to zoom. Press <Ctrl> and click and hold the left mouse button to select a point. The resolution in the viewport increases dynamically until you release the mouse; you can release <Ctrl> anytime. If you drag the mouse, the area to zoom will be re-centered on the new point under the cursor and the resolution will continue to increase. Once you are satisfied with the resolution for a particular point of interest, release the left mouse button.
To pan, press <Ctrl-Shift>, click and hold the left mouse button, and drag the mouse to a new point. The graph viewport scrolls so that a new portion of the graph is visible. You can drag the mouse anywhere on the screen, even beyond the viewport. Panning is available whenever you enable zooming.
To zoom out, press <Ctrl> and click and hold the right mouse button. In Zoom Around Point mode, the resolution in the viewport decreases dynamically until you release the mouse. In all other modes, the resolution incrementally decreases by 10% along the zoomed axes.
Note: You also can undo up to 25 of the most recent pans or zooms by pressing <Ctrl-Space> to reverse each successive change.
To programmatically enable zooming and panning, use the SetCtrlAttribute function with the control attribute ATTR_ENABLE_ZOOM_AND_PAN set to true.
Note If you enable autoscaling for the graph, autoscaling is disabled while you zoom or pan. If you plot additional data during zooming or panning, LabWindows/CVI completes the zooming or panning and then displays the new data with autoscaling.
Note The above zoom modes were introduced in LabWindows/CVI 8.5. The Zoom Around Point style matches the zooming functionality in previous versions of LabWindows/CVI.