paint method

  1. @override
void paint(
  1. BuildContext context,
  2. CanvasWrapper canvasWrapper,
  3. PaintHolder<PieChartData> holder
)
override

Paints PieChartData into the provided canvas.

Implementation

@override
void paint(
  BuildContext context,
  CanvasWrapper canvasWrapper,
  PaintHolder<PieChartData> holder,
) {
  super.paint(context, canvasWrapper, holder);
  final data = holder.data;
  if (data.sections.isEmpty) {
    return;
  }

  final sectionsAngle = calculateSectionsAngle(data.sections, data.sumValue);
  final centerRadius = calculateCenterRadius(canvasWrapper.size, holder);

  drawCenterSpace(canvasWrapper, centerRadius, holder);
  drawSections(canvasWrapper, sectionsAngle, centerRadius, holder);
  drawTexts(context, canvasWrapper, holder, centerRadius);
}