Zoom one axis at a time

I want one CartesianChart with zoom available in both axis but I need to only zoom one axis at a time, is that possible?


3 Replies

DD Dharanidharan Dharmasivam Syncfusion Team May 21, 2022 05:54 AM UTC

Hi Wise,

You can zoom one axis at a time using the zoomMode property in zoomPanBehavior. Here you can set the ZoomMode.x to zoom the chart based on horizontal axis, ZoomMode.y to zoom based on vertical axis, and ZoomMode.xy to zoom the chart based on both axes. We have attached the demo for your requirement below,

https://flutter.syncfusion.com/#/cartesian-charts/user-interactions/zooming-and-panning/pinch-zooming 

Thanks,

Dharani.




W4 W4A May 25, 2022 12:20 PM UTC

I understand that but with the ZoomMode.xy when I move my fingers in a horizontal way it get zoomed in both axis and in that case I only wanted to change the zoom in xAxis. The same happens with a vertical movement.



MG Marismathan Gurusamy Syncfusion Team May 26, 2022 02:13 PM UTC

Hi Wise,


Even with ZoomMode.xy, pinching in the x-axis direction will zoom the x axis only, and the same for the y axis. For your convenience, we have included a video regarding this. In some cases, while we zoom in on one axis, the range of another axis may change because the axis range is calculated based on the visible data points. For example, if a point with a greater y value moves out of the viewable plot while zooming along the x-axis, the Y-axis range is calculated based on the current points in the viewport. The anchorRangeToVisiblePoints property is used to calculate the value axis based on either viewport points or overall points. More information on this can be found below,


UG: https://help.syncfusion.com/flutter/cartesian-charts/axis-customization#auto-range-calculation

API: https://pub.dev/documentation/syncfusion_flutter_charts/latest/charts/ChartAxis/anchorRangeToVisiblePoints.html

Sample video: https://www.syncfusion.com/downloads/support/directtrac/general/ze/zoom_x_y2086160449


Thanks,

Marismathan G


Loader.
Up arrow icon