Profile Picture

How to determine if chart is zoomed?

Posted By Vladimir Bershadsky 11 Years Ago
Author
Message
Vladimir Bershadsky
Posted 11 Years Ago
View Quick Profile
Junior Member

Junior Member (15 reputation)Junior Member (15 reputation)Junior Member (15 reputation)Junior Member (15 reputation)Junior Member (15 reputation)Junior Member (15 reputation)Junior Member (15 reputation)Junior Member (15 reputation)Junior Member (15 reputation)

Group: Forum Members
Last Active: 10 Years Ago
Posts: 15, Visits: 1

Hi!

Tell me please, how do I determine if chart is currently zoomed or no? I looked for appropriate property/method in NAxis and NAxisPagingView classes, but didn't find any. I want to use it within Reset event of axis scrollbar, so IsZoomIn() method of range selection object (NRangeSelection) doesn't work for me either.

I need this because I have 'Reset All' button on form (to let user reset all zooming he did to chart with one click) which have to be disabled when chart is not zoomed in (say, after user clicked on reset buttons of both x and y scrollbars).

Please help me.

By the way, if I put breakpoint in Reset event of axis scrollbar and continue after debug, the control freezes and does not respond to user actions.

Best regards,

Vladimir.



Nevron Support
Posted 11 Years Ago
View Quick Profile
Supreme Being

Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)

Group: Forum Members
Last Active: Yesterday @ 1:54 AM
Posts: 3,054, Visits: 4,009

Hi Vladimir,

You can simply test whether the paging view is enabled or not:

bool isZoomed = axis.PagingView != null && axis.PagingView.Enabled;

Let us know if you meet any problems...



Best Regards,
Nevron Support Team



Vladimir Bershadsky
Posted 11 Years Ago
View Quick Profile
Junior Member

Junior Member (15 reputation)Junior Member (15 reputation)Junior Member (15 reputation)Junior Member (15 reputation)Junior Member (15 reputation)Junior Member (15 reputation)Junior Member (15 reputation)Junior Member (15 reputation)Junior Member (15 reputation)

Group: Forum Members
Last Active: 10 Years Ago
Posts: 15, Visits: 1

Hi!

Unfortunately, when I check axis.PagingView.Enabled in scrollbar Reset event, it is still set to true. It seems like Reset event happens before axis.PagingView.Enabled is reset to false.

Any other ideas, please?

Best regards,

Vladimir



Vladimir Bershadsky
Posted 11 Years Ago
View Quick Profile
Junior Member

Junior Member (15 reputation)Junior Member (15 reputation)Junior Member (15 reputation)Junior Member (15 reputation)Junior Member (15 reputation)Junior Member (15 reputation)Junior Member (15 reputation)Junior Member (15 reputation)Junior Member (15 reputation)

Group: Forum Members
Last Active: 10 Years Ago
Posts: 15, Visits: 1

Hi,

I've found a workaround for this issue. For axis being reseted, I just check if there are more ZoomedRanges than this one (of course this will work only if axis.PagingView.ResetMode == PagingViewResetMode.LastZoom).
Please see the code below:

        private bool IsChartZoomed(NAxis axis)        {            return  IsAxisZoomed(chartControl.Charts[0].Axis(StandardAxis.PrimaryX), axis)                 || IsAxisZoomed(chartControl.Charts[0].Axis(StandardAxis.PrimaryY), axis);        }         private bool IsAxisZoomed(NAxis axis, NAxis resetAxis)        {            bool isZoomed = false;            if (axis == resetAxis)            {                isZoomed = (axis.PagingView.ZoomedRanges.Count > 1);            }            else            {                isZoomed = axis.PagingView.Enabled;            }            return isZoomed;        }

From Reset event of axis scrollbar I call IsChartZoomed, passing (NAxis)((NScrollBar)sender).ParentNode as parameter. In all other cases I just pass null.

It works fine for me now, but it will be much better to have something built-in.

Regards,

Vladimir





Similar Topics


Reading This Topic