Zooming with limits

A forum dedicated to WinForms version of LightningChart Ultimate.

Moderator: Arction_LasseP

AnjaliIyengar
Posts: 6
Joined: Tue Jul 24, 2018 6:21 am

Zooming with limits

Post by AnjaliIyengar » Wed Jul 25, 2018 2:09 pm

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?

User avatar
ArctionPasi
Posts: 1365
Joined: Tue Mar 26, 2013 10:57 pm
Location: Finland

Re: Zooming with limits

Post by ArctionPasi » Thu Jul 26, 2018 9:18 am

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
LightningChart Support Team, PT

AnjaliIyengar
Posts: 6
Joined: Tue Jul 24, 2018 6:21 am

Re: Zooming with limits

Post by AnjaliIyengar » Fri Jul 27, 2018 7:41 am

Thank you :)

rolls
Posts: 3
Joined: Sun Sep 16, 2018 9:17 am

Re: Zooming with limits

Post by rolls » Wed Feb 13, 2019 5:07 am

This would be a great addition to the user manual. I was searching for "Clamp zoom, clamp limits etc" but couldn't find anything.