zoomOut method

void zoomOut()

Decreases the magnification of the plot area.

Implementation

void zoomOut() {
  _stateProperties.canSetRangeController = true;
  final SfCartesianChart chart = _stateProperties.chart;
  final ZoomPanBehaviorRenderer zoomPanBehaviorRenderer =
      _stateProperties.zoomPanBehaviorRenderer;
  zoomPanBehaviorRenderer._zoomingBehaviorDetails.isZoomOut = true;
  zoomPanBehaviorRenderer._zoomingBehaviorDetails.isZoomIn = false;
  final double? zoomFactor =
      zoomPanBehaviorRenderer._zoomingBehaviorDetails.zoomFactor;
  ChartAxisRendererDetails axisDetails;
  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) {
        zoomPanBehaviorRenderer._zoomingBehaviorDetails
            .setZoomFactorAndZoomPosition(
                _stateProperties.chartState, axisDetails, zoomFactor);
        axisDetails.zoomFactor = axisDetails.zoomFactor > 1.0
            ? 1.0
            : (axisDetails.zoomFactor < 0.0 ? 0.0 : axisDetails.zoomFactor);
      }
      if (chart.onZooming != null) {
        bindZoomEvent(chart, axisDetails, chart.onZooming!);
      }
    }
  }
  zoomPanBehaviorRenderer._zoomingBehaviorDetails.createZoomState();
}