centerViewPort method

void centerViewPort(
  1. List<double> transformedPts
)

Centers the viewport around the specified position (x-index and y-value) in the chart. Centering the viewport outside the bounds of the chart is not possible. Makes most sense in combination with the setScaleMinima(...) method.

@param transformedPts the position to center view viewport to

Implementation

void centerViewPort(final List<double> transformedPts) {
  mCenterViewPortMatrixBuffer = Matrix4.identity();
  Matrix4 save = mCenterViewPortMatrixBuffer;
  _matrixTouch.copyInto(save);

  final double x = transformedPts[0] - offsetLeft();
  final double y = transformedPts[1] - offsetTop();

  Matrix4Utils.postTranslate(save, -x, -y);

  refresh(save);
}