Pre loader

Event after zoom in

Welcome to the SciChart Forums!

  • Please read our Question Asking Guidelines for how to format a good question
  • Some reputation is required to post answers. Get up-voted to avoid the spam filter!
  • We welcome community answers and upvotes. Every Q&A improves SciChart for everyone

WPF Forums | JavaScript Forums | Android Forums | iOS Forums

1
0

Hi

I would like to do some logic after zooming in but can not find to witch event I should subscribe or overwrite ?

  • You must to post comments
1
0

Hm…OK, what about checking modifiers state in OnModifierMouseUp? Like that:

        public override void OnModifierMouseUp(ModifierMouseArgs e)
        {
            if (!IsDragging)
                return;

            base.OnModifierMouseUp(e);
        }

This should help, but anyway, please, feel free to ask if you need further assistance or have more questions!

Best regards,
Yuriy

  • You must to post comments
0
0

Hi there,

You could subscribe to IAxis.VisibleRangeChanged(you can get new/old visible range from args) or extend RubberBandZoomModifier in such a way, so it fire event every time when zoom operation performed, take a look at Zoom including annotation post, where similar behavior was implemented for ZoomExtentsModifier.

Is any of the above suitable for you?

Best regards,
Yuriy

  • Unisense A/S Tueager
    I would like to extend RubberBandZoomModifier but don't find which method to override. Tried OnModifierMouseDown but this event occurs when I just press on chart, without even marking the area to zoom. IAxis.VisibleRangeChanged don't use it because I manually update axis visible ranges so it would occur without zooming.
  • You must to post comments
0
0

Hi,

Please try to override OnModifierMouseUp method, for zooming is handled there. Let us know if this helps,

Best regards,
Yuriy

  • Unisense A/S Tueager
    Hi Yuriy I also tried OnModifierMouseUp, but it also occurs in the same way MouseDown. Though I don't select zoom area I get this event called. I guess there is some logic where it's checking x1,y1 : 2x,y2 area. So it wouldn't try to zoom if there is nowhere to zoom in. Because I wouldn't like to change chart status from Normal to ZoomedIn only on mouse click (without actually zooming in).
  • You must to post comments
0
0

Strange IsDragging was always false and another property IsStylusOver was also false.

But then I started to play with Point coordinates. I guess there is a better solution than this, but it works:

private Point point = new Point();
public event EventHandler OnZoomIn;

    public override void OnModifierMouseUp(ModifierMouseArgs e)
    {
        base.OnModifierMouseUp(e);
        if (point.X != e.MousePoint.X && point.Y != e.MousePoint.Y)
        {
            Console.WriteLine("Zoomed in");

            if (OnZoomIn != null)
                OnZoomIn(this, null);
        }
    }


    public override void OnModifierMouseDown(ModifierMouseArgs e)
    {
        point.X = e.MousePoint.X;
        point.Y = e.MousePoint.Y;
        Console.WriteLine("RubberBandZoomModifier: mouse down");

        base.OnModifierMouseDown(e);            
    }
  • Yuriy Zadereckiy
    Hi, Glad you sorted it out! Your solution is good enough as well, though it's strange that IsDragging is false everytime, we'll try to investigate. Best regards, Yuriy
  • You must to post comments
Showing 4 results
Your Answer

Please first to submit.

Try SciChart Today

Start a trial and discover why we are the choice
of demanding developers worldwide

Start TrialCase Studies