onPaint method
Draws segment in series bounds.
Implementation
@override
void onPaint(Canvas canvas) {
if (points.isEmpty || points.length != 2) {
return;
}
final Offset? start =
Offset.lerp(_oldPoints[0], points[0], animationFactor);
final Offset? end = Offset.lerp(_oldPoints[1], points[1], animationFactor);
final double controlX1 =
lerpDouble(_oldStartControlX, startControlX, animationFactor)!;
final double controlY1 =
lerpDouble(_oldStartControlY, startControlY, animationFactor)!;
final double controlX2 =
lerpDouble(_oldEndControlX, endControlX, animationFactor)!;
final double controlY2 =
lerpDouble(_oldEndControlY, endControlY, animationFactor)!;
if (start != null && end != null) {
final Path path = Path()
..moveTo(start.dx, start.dy)
..cubicTo(controlX1, controlY1, controlX2, controlY2, end.dx, end.dy);
final Paint paint = getStrokePaint();
if (paint.color != Colors.transparent && paint.strokeWidth > 0) {
drawDashes(canvas, series.dashArray, paint, path: path);
}
}
}