zoomToSingleAxis method Null safety

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) {
  _stateProperties.canSetRangeController = true;
  final ChartAxisRenderer? axisRenderer = findExistingAxisRenderer(
      axis, _stateProperties.chartAxis.axisRenderersCollection);
  final ChartAxisRendererDetails axisDetails =
      AxisHelper.getAxisRendererDetails(axisRenderer!);
  if (axisRenderer != null) {
    axisDetails.zoomFactor = zoomFactor;
    axisDetails.zoomPosition = zoomPosition;
    _stateProperties.zoomPanBehaviorRenderer._zoomingBehaviorDetails
        .createZoomState();
  }
}