transformValues method

  1. @override
void transformValues()
override

Transforms the x and y values to screen coordinates.

Implementation

@override
void transformValues() {
  if (x.isNaN || top.isNaN || bottom.isNaN) {
    segmentRect = null;
    _oldSegmentRect = null;
    points.clear();
    return;
  }

  points.clear();
  final PointToPixelCallback transformX = series.pointToPixelX;
  final PointToPixelCallback transformY = series.pointToPixelY;
  final num left = x + series.sbsInfo.minimum;
  final num right = x + series.sbsInfo.maximum;

  final double x1 = transformX(left, top);
  final double y1 = transformY(left, top);
  final double x2 = transformX(right, bottom);
  final double y2 = transformY(right, bottom);

  final BorderRadius borderRadius = series._borderRadius;
  segmentRect = toRRect(x1, y1, x2, y2, borderRadius);
  _oldSegmentRect ??= toRRect(
    transformX(left, _actualBottom),
    transformY(left, _actualBottom),
    transformX(right, _actualBottom),
    transformY(right, _actualBottom),
    borderRadius,
  );
}