paint method

  1. @override
void paint(
  1. Context context
)
override

Draw itself and its children, according to the calculated box.offset

Implementation

@override
void paint(Context context) {
  super.paint(context);

  final datasets = Chart.of(context).datasets;

  context.canvas
    ..saveContext()
    ..setTransform(
      Matrix4.translationValues(box!.width / 2, box!.height / 2, 0),
    );

  for (final dataSet in datasets) {
    if (dataSet is PieDataSet) {
      dataSet.paintBackground(context);
    }
  }

  for (final dataSet in datasets) {
    if (dataSet is PieDataSet) {
      dataSet.paint(context);
    }
  }

  for (final dataSet in datasets) {
    if (dataSet is PieDataSet) {
      dataSet.paintLegend(context);
    }
  }

  context.canvas.restoreContext();
}