autoScale method

void autoScale()

Performs auto scaling of the axis by recalculating the minimum and maximum y-values based on the entries currently in view.

Implementation

void autoScale() {
  final double fromX = getLowestVisibleX();
  final double toX = getHighestVisibleX();

  getData()!.calcMinMaxY(fromX, toX);

  xAxis!.calculate(getData()!.xMin, getData()!.xMax);

  // calculate axis range (min / max) according to provided data

  if (axisLeft!.enabled) {
    axisLeft!.calculate(getData()!.getYMin2(AxisDependency.left),
        getData()!.getYMax2(AxisDependency.left));
  }

  if (axisRight!.enabled) {
    axisRight!.calculate(getData()!.getYMin2(AxisDependency.right),
        getData()!.getYMax2(AxisDependency.right));
  }

  calculateOffsets();
}