SciChart® the market leader in Fast WPF Charts, WPF 3D Charts, and now iOS Charting & Android Chart Components

Welcome to the SciChart Community Forums!

Please use the forums below to ask questions about SciChart. Take a moment to read our Question asking guidelines on how to ask a good question and our support policy. We also have a tag=SciChart on where you can earn rep for your questions!

Please note: SciChart team will only answer questions from customers with active support subscriptions. Expired support questions will be ignored. If your support status shows incorrectly, contact us and we will be glad to help.


How can I add shortcut keys for RubberBandXyZoomModifier and ZoomPanModifier?

When I do Cntl++ my chart should zoom in and when I click right arrow, my chart should pan right.

Thanks in advance,

  • You must to post comments

Hi Vibin,

Something like this will work:

/// <summary>
/// A single X-Y axis implementation of a Zooming In / Out on KeyDown (CTRL+, CTRL-), used to demonstrate the ChartModifierBase and Axis Interactivity APIs in SciChart
/// </summary>
public class SimpleZoomInOutModifier : ChartModifierBase
    public static readonly DependencyProperty ZoomFractionProperty = DependencyProperty.Register("ZoomFraction", typeof(double), typeof(SimpleZoomInOutModifier), new PropertyMetadata(0.1));

    public double ZoomFraction
        get { return (double)GetValue(ZoomFractionProperty); }
        set { SetValue(ZoomFractionProperty, value); }

    public override void OnModifierKeyDown(ModifierKeyArgs e)

        double factor = 0;

        if ((e.Key == Key.Add || e.Key == Key.OemPlus) && Keyboard.Modifiers.HasFlag(ModifierKeys.Control))
            // On CTRL+, Zoom In
            factor = -ZoomFraction;
        if ((e.Key == Key.Subtract || e.Key == Key.OemMinus) && Keyboard.Modifiers.HasFlag(ModifierKeys.Control))
            // On CTRL-, Zoom Out
            factor = ZoomFraction;

        using (ParentSurface.SuspendUpdates())
            // Zoom the XAxis by the required factor
            XAxis.ZoomBy(factor, factor, TimeSpan.FromMilliseconds(500));

            // Zoom the YAxis by the required factor
            YAxis.ZoomBy(factor, factor, TimeSpan.FromMilliseconds(500));

            // Note.. can be extended for multiple YAxis XAxis, just iterate over all axes on the parent surface

Use this custom modifier and attach to your SciChartSurface.ChartModifier property. Then use CTRL ++ to zoom in and CTRL+- to zoom out.

Panning is equally simple. You can use XAxis.Scroll method to programmatically pan.

Best regards,

  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.