paint method

  1. @override
void paint(
  1. ChartCanvas canvas,
  2. Rectangle<num> bounds, {
  3. List<int>? dashPattern,
  4. Color? fillColor,
  5. FillPatternType? fillPattern,
  6. Color? strokeColor,
  7. double? strokeWidthPx,
})
override

Implementation

@override
void paint(ChartCanvas canvas, Rectangle<num> bounds,
    {List<int>? dashPattern,
    Color? fillColor,
    FillPatternType? fillPattern,
    Color? strokeColor,
    double? strokeWidthPx}) {
  // To maximize the size of the triangle in the available space, we can use
  // the width as the length of each size. Set the bottom edge to be the full
  // width, and then calculate the height based on the 30/60/90 degree right
  // triangle whose tall side is the height of our equilateral triangle.
  final dy = sqrt(3) / 2 * bounds.width;
  final centerX = (bounds.left + bounds.right) / 2;
  canvas.drawPolygon(
      points: [
        Point(bounds.left, bounds.top + dy),
        Point(bounds.right, bounds.top + dy),
        Point(centerX, bounds.top),
      ],
      fill: getSolidFillColor(fillColor),
      stroke: strokeColor,
      strokeWidthPx: getSolidStrokeWidthPx(strokeWidthPx));
}