transformValues method
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 sbsMaximum = series.sbsInfo.maximum;
final num right = x + sbsMaximum;
final double centerY = (bottom + top) / 2;
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, centerY),
transformY(left, centerY),
transformX(right, centerY),
transformY(right, centerY),
borderRadius,
);
if (currentSegmentIndex > 0) {
final WaterfallSegment<T, D> oldSegment =
series.segments[currentSegmentIndex - 1] as WaterfallSegment<T, D>;
final num oldSegmentRight = oldSegment.x + sbsMaximum;
final num oldSegmentTop = oldSegment.top;
points.add(Offset(
transformX(oldSegmentRight, oldSegmentTop),
transformY(oldSegmentRight, oldSegmentTop),
));
if (isTotalSum || isIntermediateSum) {
points.add(Offset(x1, y1));
} else {
series.isTransposed
? points.add(Offset(x2, y1))
: points.add(Offset(x1, y2));
}
}
}