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

0
0

Hello. I would like to load data as needed when the user pans or zooms. I’ve looked at the examples but don’t see an example of a method being called when a pan/zoom occurs. I’ve tried adding MouseUp=”chart2D_panZoomEvent” MouseWheel=”chart2D_panZoomEvent” to my chart definition but the methods don’t appear to be called.

Thanks,
Daryl.

Version
4.2.2.9777
  • You must to post comments
0
0

Hi Daryl,

We don’t have such events but there are some other things you can do.

1 You can subscribe to AxisBase.VisibleRangeChanged event.

This event occurs whenever the axis range changes, such as after a Zoom, Pan operation or after an autorange operation. The event args for this event contain a flag ‘IsAnimating’. When true the visible range change was the result of an animated event such as an animated Zoom Extents. There will always be one more event raised at the end of an operation with IsAnimating=false.

2 You can override MouseUp, MouseWheel on the modifiers

For example, given ZoomPanModifier, create a class ZoomPanModifierEx and override OnModifierMouseUp. When the base MouseUp has been called, the pan operation is completed.

public class ZoomPanModifierEx : ZoomPanModifier
{
    public override void OnModifierMouseUp(ModifierMouseArgs e)
    {
        bool wasPanning = IsDragging;
        base.OnModifierMouseUp(e);
        if (wasPanning)
        {
            // Pan operation has completed 
        }
    }
}

You can do the same with the MouseWheelToZoomPanModifier by overriding OnModifierMouseWheel etc…

Let me know if either of these help.

Best regards,
Andrew

  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.