zoomToSingleAxis method

void zoomToSingleAxis(
  1. ChartAxis axis,
  2. double zoomPosition,
  3. double zoomFactor
)

Change the zoom level of an appropriate axis.

Here, you need to pass axis, zoom factor, zoom position of the zoom level that needs to be modified.

Implementation

void zoomToSingleAxis(
    ChartAxis axis, double zoomPosition, double zoomFactor) {
  _chartState!._canSetRangeController = true;
  final SfCartesianChartState chartState = _chartState!;
  final ZoomPanBehaviorRenderer zoomPanBehaviorRenderer =
      chartState._zoomPanBehaviorRenderer;
  final ChartAxisRenderer? axisRenderer = _findExistingAxisRenderer(
      axis, chartState._chartAxis._axisRenderersCollection);
  if (axisRenderer != null) {
    axisRenderer._zoomFactor = zoomFactor;
    axisRenderer._zoomPosition = zoomPosition;
    zoomPanBehaviorRenderer._createZoomState();
  }
}