setData method

  1. @override
void setData(
  1. int index,
  2. ChartSegment segment
)
override

Implementation

@override
void setData(int index, ChartSegment segment) {
  super.setData(index, segment);

  final num yValue = segment.isVisible ? circularYValues[index] : 0;
  double degree = yValue / (maximumValue ?? (sumOfY != 0 ? sumOfY : 1));
  degree = degree * fullAngle;
  final double pointEndAngle = pointStartAngle + degree;
  final double innerRadius = currentInnerRadius = segment.isVisible
      ? (currentInnerRadius +
          ((index == firstVisibleIndex) ? 0 : ringSize) -
          (trackBorderWidth / 2) / dataCount)
      : currentInnerRadius;
  final double outerRadius = ringSize < segmentGap!
      ? 0
      : innerRadius +
          ringSize -
          segmentGap! -
          (trackBorderWidth / 2) / dataCount;

  segment as RadialBarSegment<T, D>
    ..series = this
    .._degree = degree
    .._startAngle = pointStartAngle
    ..endAngle = pointEndAngle
    .._center = center
    ..innerRadius = innerRadius
    ..outerRadius = outerRadius;
}