paint method

  1. @override
void paint(
  1. ChartCanvas canvas,
  2. Point<double> p1,
  3. double radius, {
  4. required Point<double> p2,
  5. Color? fillColor,
  6. Color? strokeColor,
  7. double? strokeWidthPx,
})
override

Implementation

@override
void paint(ChartCanvas canvas, Point<double> p1, double radius,
    {required Point<double> p2,
    Color? fillColor,
    Color? strokeColor,
    double? strokeWidthPx}) {
  if (p1 == null) {
    throw ArgumentError('Invalid point p1 "$p1"');
  }

  if (p2 == null) {
    throw ArgumentError('Invalid point p2 "$p2"');
  }

  final adjustedP1 = Point<double>(p1.x, p1.y);
  final adjustedP2 = Point<double>(p2.x, p2.y);

  canvas.drawLine(
      points: [adjustedP1, adjustedP2],
      stroke: strokeColor,
      roundEndCaps: true,
      strokeWidthPx: radius * 2);
}