decorate method

  1. @override
void decorate(
  1. List<ArcRendererElementList<D>> arcElementsList,
  2. ChartCanvas canvas,
  3. GraphicsFactory graphicsFactory, {
  4. required Rectangle<num> drawBounds,
  5. required double animationPercent,
  6. bool rtl = false,
})
override

Implementation

@override
void decorate(
  List<ArcRendererElementList<D>> arcElementsList,
  ChartCanvas canvas,
  GraphicsFactory graphicsFactory, {
  required Rectangle drawBounds,
  required double animationPercent,
  bool rtl = false,
}) {
  /// TODO: Improve label handling for sunburst chart. When a
  /// more sophisticated collision detection is in place, we can draw the
  /// label for inner arc outside when it doesn't collide with outer arcs.
  if (extendLeaderLine) {
    // Resets collision detection params.
    _collisionDetectionParams = [];
    // Find the largest of radius in the arcElementList for the leader line.
    _outerMostRadius = 0.0;
    for (final arcElements in arcElementsList) {
      if (arcElements.radius > _outerMostRadius!) {
        _outerMostRadius = arcElements.radius;
      }
    }
  }

  // Do not draw label for arcs on the inner ring if positioned outside.
  if (innerRingArcLabelPosition == ArcLabelPosition.outside) {
    for (final arcElements in arcElementsList) {
      arcElements.arcs.retainWhere(
        (e) => (e as SunburstArcRendererElement).isLeaf == true,
      );
    }
  }
  super.decorate(
    arcElementsList,
    canvas,
    graphicsFactory,
    drawBounds: drawBounds,
    animationPercent: animationPercent,
    rtl: rtl,
  );
}