moveViewToY method

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

This will center 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 moveViewToY(double yValue, AxisDependency axis) {
  double yInView = getAxisRange(axis) / viewPortHandler!.getScaleY();
  List<double> pts = List.empty(growable: true);
  pts.add(0.0);
  pts.add(yValue + yInView / 2);

  painter?.getTransformer(axis)?.pointValuesToPixel(pts);
  viewPortHandler!.centerViewPort(pts);
}