zoomByFactor method

void zoomByFactor(
  1. double zoomFactor
)

Changes the zoom level using zoom factor.

Here, you can pass the zoom factor of an axis to magnify the plot area. The value ranges from 0 to 1.

Implementation

void zoomByFactor(double zoomFactor) {
  final RenderBehaviorArea? parent = parentBox as RenderBehaviorArea?;
  if (parent == null) {
    return;
  }
  parent.hideInteractiveTooltip();
  final RenderCartesianAxes? cartesianAxes = parent.cartesianAxes;
  if (cartesianAxes == null) {
    return;
  }
  cartesianAxes.visitChildren((RenderObject child) {
    if (child is RenderChartAxis) {
      if (_canZoom(child)) {
        child.controller.zoomFactor = max(zoomFactor, maximumZoomLevel);
        if (parent.onZooming != null) {
          _bindZoomEvent(child, parent.onZooming!);
        }
      }
    }
  });
}