centerViewToY method

void centerViewToY(
  1. double yValue,
  2. AxisDependency axis
)

Centers the viewport to the specified y value on the y-axis. call state?.setStateIfNotDispose() to invalidate

@param yValue @param axis - which axis should be used as a reference for the y-axis

Implementation

void centerViewToY(double yValue, AxisDependency axis) {
  double valsInView = getAxisRange(axis) / viewPortHandler!.getScaleY();
  List<double> pts = List.empty(growable: true);
  pts.add(0.0);
  pts.add(yValue + valsInView / 2);
  painter?.getTransformer(axis)?.pointValuesToPixel(pts);
  viewPortHandler!.centerViewPort(pts);
}