We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Is it possible to limit zoom level for chart?

Hello,

In old version (Classic) there was some limit in zooming. I think based on data resolution level. In new version I could zoom to any level,
even without good connection lines and without axis labels on this level.

Is it possible to somehow reproduce old behavior and limit available zoom level? In old version it shows ""XZoomFactor or YZoomFactor is not inside the limit of zooming"

1 Reply

SK Sanjith Kesavan Syncfusion Team March 31, 2016 12:19 PM UTC

Hi Yauhen,

Thanks for contacting Syncfusion support. We have analyzed your query. For limiting zooming action we have written following code in preRender and zoomed event.
[JS]

function prerender(args) {

            pxZoomfactor = args.model.primaryXAxis.zoomFactor;

            pyZoomfactor = args.model.primaryYAxis.zoomFactor;

            pxzoomposition = args.model.primaryXAxis.zoomPosition;

            pyzoompostion = args.model.primaryYAxis.zoomPosition;
    }

function zoomed(args) {

        if (args.model.primaryXAxis.zoomFactor == pxZoomfactor && args.model.primaryXAxis.zoomPosition == pxzoomposition) {

            isZoomed = true;

            $("#annotation_Container_annotation_0").fadeIn(3000);

            setTimeout(function () {

                $("#annotation_Container_annotation_0").css("display", "none");

                isZoomed = false;

                ;

            }, 3000);

        }


    }


In “preRender” event, we have simply get the zoomposition and zoomfactor for both of the axis. In “zoomed” event, we have compared the zoomfactor and zoomposition with previous zoomfactor and zoomposition stored in the prerender event. If these are same, then zoomfactor of the chart is getting lesser than 0.001. In this case we have displayed the text “Minimum zooming value reached” inside the chart using annotation. Please find the below screenshots.
While running the sample

First time zooming the chart

Second time zooming the chart.


In the below link, we have attached the sample for your reference.
Sample link: http://www.syncfusion.com/downloads/support/forum/123554/ze/Zooming-1270615698

Please let us know if you have any concern.

Regards,
Sanjith.

Loader.
Live Chat Icon For mobile
Up arrow icon