Page 1 of 1

Zooming with limits

Posted: Wed Jul 25, 2018 2:09 pm
by AnjaliIyengar
Hi Team,

I am using Winforms.
I am zooming my line graph with both right mouse button - rectangle zoom and mouse wheel. But i want to limit the zooming.
1) Not zoom below 0 (origin - time axis) on x-Axis.
2) Not zoom out beyond the graph data. (if you zoom out more, then the graph becomes smaller and eventually a thin straight line.)
Can you please tell me which property I have to set?

Re: Zooming with limits

Posted: Thu Jul 26, 2018 9:18 am
by ArctionPasi
Hi,

ViewXY has BeforeZooming and AfterZooming events available for making special zooming behavior, such as limiting the zooming.

Code: Select all

_chart.ViewXY.BeforeZooming += ViewXY_BeforeZooming;        

private void ViewXY_BeforeZooming(object sender, BeforeZoomingXYEventArgs e)
        {
            if (e.XRanges[0].NewMin < 0)
            {
                e.XRanges[0].Axis.Minimum = 0; 
            }
        }
Or if your limiting min and max, use e.XRanges[0].Axis.SetRange method.

There is also BeforePanning event available.

See also
https://forum.arction.com/viewtopic.php ... 286&p=4314

Re: Zooming with limits

Posted: Fri Jul 27, 2018 7:41 am
by AnjaliIyengar
Thank you :)

Re: Zooming with limits

Posted: Wed Feb 13, 2019 5:07 am
by rolls
This would be a great addition to the user manual. I was searching for "Clamp zoom, clamp limits etc" but couldn't find anything.