paint method

  1. @override
void paint(
  1. ChartCanvas canvas,
  2. double animationPercent
)

Renders the series data on the canvas, using the data generated during the update call.

Implementation

@override
void paint(ChartCanvas canvas, double animationPercent) {
  // Clean up the arcs that no longer exist.
  if (animationPercent == 1.0) {
    final keysToRemove = <String>[];

    _seriesArcMap.forEach((String key, List<AnimatedArcList<D>> arcLists) {
      final arcListToRemove = <AnimatedArcList<D>>[];
      for (var arcList in arcLists) {
        arcList.arcs.removeWhere((AnimatedArc<D> arc) => arc.animatingOut);

        if (arcList.arcs.isEmpty) {
          arcListToRemove.add(arcList);
        }
      }

      arcListToRemove.forEach(arcLists.remove);
      if (arcLists.isEmpty) {
        keysToRemove.add(key);
      }
    });

    keysToRemove.forEach(_seriesArcMap.remove);
  }

  super.paint(canvas, animationPercent);
}