# Operating Graph Controls

When you set a graph control to any mode other than indicator mode, you can operate graph cursors and zoom and pan the viewport from the keyboard or with the mouse. You also can use the mouse to operate graph annotations or access a customization menu from the graph legend.

## Graph Cursors

You can associate one or more cursors with graph controls. Use cursors to select a point or region of the graph for more processing or analysis. If you set the mode of the graph control to hot, cursors generate commit events. If you want to use cursors in a graph control, set the graph control to a mode other than indicator.

You can use the keyboard to operate a graph with cursors, both free-form and snap-to-point cursors, as described in the following table.

Keyboard Actions for Cursors

Type of Cursor | When you press... | You select...
Free-form and snap-to-point | <Page-Up> | Previous cursor.
| <Page-Down> | Next cursor.
Free-form | Left arrow key | Left 10 pixels.
| Right arrow key | Right 10 pixels.
| Up arrow key | Up 10 pixels.
| Down arrow key | Down 10 pixels.
| <Shift>-left arrow key | Left 1 pixel.
| <Shift>-right arrow key | Right 1 pixel.
| <Shift>-up arrow key | Up 1 pixel.
| <Shift>-down arrow key | Down 1 pixel.
| <Ctrl>-left arrow key | To the left edge of the plot area.
| <Ctrl>-right arrow key | To the right edge of the plot area.
| <Ctrl>-up arrow key | To the top edge of the plot area.
| <Ctrl>-down arrow key | To the bottom edge of the plot area.
| <Home> | To the lower left corner of the plot area.
| <End> | To the upper right corner of the plot area.
Snap-to-point | Left arrow key | To the previous point on the current plot.
| Right arrow key | To the next point on the current plot.
| Up arrow key | To the next point on the current plot.
| Down arrow key | To the previous point on the current plot.
| <Shift>-left arrow key | Back 10 points on the current plot.
| <Shift>-right arrow key | Forward 10 points on the current plot.
| <Shift>-up arrow key | Forward 10 points on the current plot.
| <Shift>-down arrow key | Back 10 points on the current plot.
| <Ctrl>-left arrow key | Left to the closest point in the x direction on the current plot.
| <Ctrl>-right arrow key | Right to the closest point in the x direction on the current plot.
| <Ctrl>-up arrow key | Up to the closest point in the y direction on the current plot.
| <Ctrl>-down arrow key | Down to the closest point in the y direction on the current plot.
| <Home> | To the first visible point on the current plot.
| <End> | To the last visible point on the current plot.
| <Shift-Page Up> | To the previous plot.
| <Shift-Page Down> | To the next plot.

If you configure the graph as a hot control, you generate an event whenever you press one of the keys in the preceding table.

You can use the mouse to operate a graph with cursors in the following ways:

- Drag a cursor to move it. If the cursor is in snap-to-point mode, the cursor tracks the mouse until you release the mouse button, and then the cursor snaps to the nearest data point. If the cursor is in free-form mode, the cursor tracks the mouse until you release the mouse button, and then the cursor stays at the new position.
- Move a cursor left and right by holding down <Shift> and dragging the vertical cross hair line projecting outward from the cursor position. Likewise, you can move a cursor up and down by dragging the horizontal cross hair line.

The following behaviors generate a commit event in a graph control that you set to hot mode:

- When the user moves the cursor with the arrow keys
- When the user releases the mouse after moving a cursor

Value changed events are generated continuously while a user drags a graph cursor.

## Graph Annotations

You can add annotations to graph controls to mark specific data points on the graph. If you want to operate annotations in a graph control, set the graph control to a mode other than indicator. Use the mouse to move an annotation caption. This action generates value changed events continuously. You generate a commit event when you release the mouse after moving an annotation caption. When you drag an annotation caption, the caption moves to the front of the z-plane order. The caption moves back to its original z-plane position when you release the mouse.

## Interactive Graph Legend

If you enable ATTR_LEGEND_INTERACTIVE or enable the Interactive Legend option in the User Interface Editor Legend Settings dialog box, you give users the ability to edit various plot attributes at run time. When you enable this attribute or option, a user can right-click a graph legend at run time to launch a customization menu, which includes items such as plot color, plot style, and so on. You also can use the customization menu to rename the selected plot. Some customization menu items are not available for all plot styles.

| Note The customization menu is unavailable if the graph is in indicator mode.

## Zooming and Panning on Graphs

You can use zooming—the ability to expand or contract the viewport around a particular point—in graph controls. When you zoom in, the logical area contained in the viewport gets smaller, thereby showing the area with more resolution. When you zoom out, the viewport shows a wider area. You can also use panning, the ability to shift the viewport.

By default, zooming and panning are disabled. Enable these features in the Edit Graph dialog box or programmatically. If you want to enable zooming and panning in a graph control, set the graph control to a mode other than indicator.

To start zooming in on a point, press the <Ctrl> key and click the left mouse button over the point; you can release the <Ctrl> key after you press the mouse button. The resolution in the viewport increases dynamically until you release the mouse. If you drag the mouse, the zooming continues but does so over the new point under the mouse cursor. The zooming stops when you release the left mouse button or click on the right mouse button.

To zoom out, click the right mouse button and then press the <Ctrl> key as you do to zoom in.

To pan, press the <Ctrl-Shift> keys and click the left mouse button over a point on the viewport. Then drag the mouse to another point. The graph viewport scrolls so that the original point now appears under the new mouse cursor location. You can drag the mouse anywhere on the screen, even beyond the viewport.

Press <Ctrl-Spacebar> to restore the last view before you zoomed or panned.

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.