zoomIn method Null safety

void zoomIn()

Increases the magnification of the plot area.

Implementation

void zoomIn() {
  _stateProperties.canSetRangeController = true;
  final SfCartesianChart chart = _stateProperties.chart;
  final ZoomPanBehaviorRenderer zoomPanBehaviorRenderer =
      _stateProperties.zoomPanBehaviorRenderer;
  zoomPanBehaviorRenderer._zoomingBehaviorDetails.isZoomIn = true;
  zoomPanBehaviorRenderer._zoomingBehaviorDetails.isZoomOut = false;
  final double? zoomFactor =
      zoomPanBehaviorRenderer._zoomingBehaviorDetails.zoomFactor;
  _stateProperties.zoomProgress = true;
  ChartAxisRendererDetails axisDetails;
  bool? needZoom;
  for (int index = 0;
      index < _stateProperties.chartAxis.axisRenderersCollection.length;
      index++) {
    axisDetails = AxisHelper.getAxisRendererDetails(
        _stateProperties.chartAxis.axisRenderersCollection[index]);
    if ((axisDetails.orientation == AxisOrientation.vertical &&
            chart.zoomPanBehavior.zoomMode != ZoomMode.x) ||
        (axisDetails.orientation == AxisOrientation.horizontal &&
            chart.zoomPanBehavior.zoomMode != ZoomMode.y)) {
      if (axisDetails.zoomFactor <= 1.0 && axisDetails.zoomFactor > 0.0) {
        if (axisDetails.zoomFactor - 0.1 < 0) {
          needZoom = false;
          break;
        } else {
          zoomPanBehaviorRenderer._zoomingBehaviorDetails
              .setZoomFactorAndZoomPosition(
                  _stateProperties.chartState, axisDetails, zoomFactor);
          needZoom = true;
        }
      }
      if (chart.onZooming != null) {
        bindZoomEvent(chart, axisDetails, chart.onZooming!);
      }
    }
  }
  if (needZoom == true) {
    zoomPanBehaviorRenderer._zoomingBehaviorDetails.createZoomState();
  }
}