transformValues method

  1. @override
void transformValues()
override

Transforms the x and y values to screen coordinates.

Implementation

@override
void transformValues() {
  if (x.isNaN || y.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, y);
  final double y1 = transformY(left, y);
  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, bottom),
    transformY(left, bottom),
    x2,
    y2,
    borderRadius,
  );

  if (series.isTrackVisible) {
    calculateTrackerBounds(
      left,
      right,
      borderRadius,
      series.trackPadding,
      series.trackBorderWidth,
      series,
    );
  }
}