calculateLabelPosition method

  1. @override
ArcLabelPosition calculateLabelPosition(
  1. TextElement labelElement,
  2. TextStyle labelStyle,
  3. int insideArcWidth,
  4. int outsideArcWidth,
  5. ArcRendererElement arcRendererElement,
  6. ArcLabelPosition labelPosition,
)
override

Implementation

@override
ArcLabelPosition calculateLabelPosition(
    TextElement labelElement,
    TextStyle labelStyle,
    int insideArcWidth,
    int outsideArcWidth,
    ArcRendererElement arcRendererElement,
    ArcLabelPosition labelPosition) {
  assert(arcRendererElement is SunburstArcRendererElement);

  if ((arcRendererElement as SunburstArcRendererElement).isOuterMostRing ==
      true) {
    return super.calculateLabelPosition(
        labelElement,
        labelStyle,
        insideArcWidth,
        outsideArcWidth,
        arcRendererElement,
        outerRingArcLabelPosition);
  } else if ((arcRendererElement as SunburstArcRendererElement).isLeaf ==
      true) {
    return super.calculateLabelPosition(
        labelElement,
        labelStyle,
        insideArcWidth,
        outsideArcWidth,
        arcRendererElement,
        innerRingLeafArcLabelPosition);
  } else {
    /// 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.

    // Force label for arc on the inner ring inside.
    return ArcLabelPosition.inside;
  }
}