Zooming and Panning with a Single Chart
You can also implement zooming and panning using a single chart. The easiest way to achieve this is to use the Actions property and the built-in mouse actions. C1Chart includes built-in actions for zooming, scaling, and panning the chart with the mouse.
The code below shows how you can add mouse actions to a C1Chart control:
// Show chart as usual
SalesPerRegionBar_Click(this, null);
// Add zoom action to mouse drag
_c1Chart.Actions.Add(new ZoomAction());
// Add scale action to control-mouse drag
_c1Chart.Actions.Add(new ScaleAction() { Modifiers = ModifierKeys.Control });
// Add pan action to shift-mouse drag
_c1Chart.Actions.Add(new TranslateAction() { Modifiers = ModifierKeys.Shift });
Once the actions have been added to the Actions collection, you can use the mouse to perform the following actions:
• Zoom: Use the mouse to select a portion of the chart. When you release the mouse button, the chart will zoom in on the selected portion of the chart. This action allows you to zoom in but not to zoom out.
• Scale: Press the control button and move the mouse up or down to scale the chart interactively.
• Pan: Press the shift button and move the mouse to pan the display and see different portions of the chart without modifying the scale.
All built-in actions work by automatically setting the Scale property on each axis. You can limit or disable the actions by setting the MinScale property to one for either axis.