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
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

UWP- double tap zoom out doesnt work

Thread ID:





144039 Apr 15,2019 10:32 PM UTC Apr 23,2019 11:03 AM UTC Xamarin.Forms 1
Tags: SfChart
Asked On April 15, 2019 10:32 PM UTC

When i click double tap on andorid it zooms in and another double tap, zooms out.
I try the same action on UWP, zoom in works but zoom out wont work. below is my implementation of sfchart

                <chart:SfChart x:Name="Chart" SelectionChanged="Chart_SelectionChanged" HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand"  

                        <chart:DateTimeCategoryAxis AutoScrollingDelta="7"   AutoScrollingMode="End"  >


                                <chart:ChartAxisTitle Text="{resx:Translate Date}"></chart:ChartAxisTitle>





                        <chart:NumericalAxis  Minimum="0" Maximum="{Binding NumericalAxisMax}" Interval="{Binding NumericalAxisInterval}" >


                                <chart:ChartAxisTitle Text="{Binding NumericalAxisTitle}" ></chart:ChartAxisTitle>





                        <chart:LineSeries EnableDataPointSelection="{Binding EnableDataPointSelection}"  XBindingPath="XValue" YBindingPath="YValue" 
                                  SelectedDataPointColor="Yellow"  ItemsSource="{Binding NumericMonthStats, Mode=OneWay}"  EnableAnimation = "true"
                                  AnimationDuration="0.8" >


                        <chart:ChartZoomPanBehavior x:Name="ZoomBehavior"  ZoomMode="X"/>



Bharathiraja K [Syncfusion]
Replied On April 23, 2019 11:03 AM UTC

Hi Emil, 
We have prepared the custom solution to achieve zoom in and zoom out by inheriting ChartZoomPanBehavior as a workaround for UWP. 
Please find the code snippet below. 
Note: Add below codes only for UWP. 
    public class CustomZoomPanBehavior: ChartZoomPanBehavior 
        protected override void DoubleTap(float pointX, float pointY) 
            if (Device.RuntimePlatform == Device.UWP) 
                if (EnableDoubleTap && !EnableSelectionZooming) 
                    var axis = Chart.PrimaryAxis; 
                    if (axis.ZoomFactor == 1 && axis.ZoomPosition == 0) 
                        var seriesBound = Chart.SeriesBounds; 
                        var manipulationX = pointX - seriesBound.Left - Chart.ChartPadding.Left; 
                        var manipulationY = pointY - seriesBound.Top - Chart.ChartPadding.Top; 
                        var origin = GetOrigin(manipulationX, manipulationY, seriesBound.Width, seriesBound.Height, axis); 
                        Zoom(axis, 2.5f, origin); 
                base.DoubleTap(pointX, pointY); 
        private static float GetOrigin(double manipulationX, double manipulationY, double width, double height, ChartAxis chartAxis) 
            float origin; 
            if (!chartAxis.IsVertical) 
                origin = (float)(chartAxis.IsInversed 
                    ? 1.0 - ((manipulationX - chartAxis.PlotOffset) / width) 
                    : (manipulationX - chartAxis.PlotOffset) / width); 
                origin = (float)(chartAxis.IsInversed 
                    ? (manipulationY - chartAxis.PlotOffset) / height 
                    : 1 - ((manipulationY - chartAxis.PlotOffset) / height)); 
            return origin; 
            <local:CustomZoomPanBehavior ZoomMode="X"/> 
And we have prepared the sample, that can be downloaded from below link. 


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon