setVisibleYRangeMaximum method

void setVisibleYRangeMaximum(
  1. double maxYRange,
  2. AxisDependency axis
)

Limits how much of a y axis can be visible at once, so the user cannot zoom out further. Computed from the current axis range, so call it after data is set. A range that is not above 0 does nothing.

maxYRange is the largest visible span in y values and axis the y axis the span refers to.

Implementation

void setVisibleYRangeMaximum(double maxYRange, AxisDependency axis) {
  final yScale = scaleForVisibleRange(getAxisRange(axis), maxYRange);
  if (yScale == null) return;
  viewPortHandler.setMinimumScaleY(yScale);
}