calculateLabelPosition method
ArcLabelPosition
calculateLabelPosition(
- TextElement labelElement,
- TextStyle labelStyle,
- int insideArcWidth,
- int outsideArcWidth,
- ArcRendererElement<
D> arcRendererElement, - ArcLabelPosition labelPosition,
override
Implementation
@override
ArcLabelPosition calculateLabelPosition(
TextElement labelElement,
TextStyle labelStyle,
int insideArcWidth,
int outsideArcWidth,
ArcRendererElement<D> arcRendererElement,
ArcLabelPosition labelPosition,
) {
assert(arcRendererElement is SunburstArcRendererElement);
final sunburstArcRendererElement =
arcRendererElement as SunburstArcRendererElement<D>;
if (sunburstArcRendererElement.isOuterMostRing ?? false) {
return super.calculateLabelPosition(
labelElement,
labelStyle,
insideArcWidth,
outsideArcWidth,
arcRendererElement,
outerRingArcLabelPosition,
);
} else if (arcRendererElement.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;
}
}