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);

  num yValue = circularYValues[index].abs();
  // Handled the empty point here.
  yValue = yValue.isNaN || !segment.isVisible ? 0 : yValue;
  final double degree =
      (yValue.abs() / (sumOfY != 0 ? sumOfY : 1)) * totalAngle;
  final double pointEndAngle = pointStartAngle + degree;
  final double outerRadius = pointRadii.isNotEmpty
      ? percentToValue(pointRadii[index], (min(size.width, size.height)) / 2)!
      : currentRadius;

  segment as PieSegment<T, D>
    ..series = this
    .._degree = degree
    ..startAngle = pointStartAngle
    ..endAngle = pointEndAngle
    .._outerRadius = outerRadius
    .._center = center
    .._isExploded = explode && (index == explodeIndex || explodeAll)
    ..isEmpty = (emptyPointSettings.mode != EmptyPointMode.drop &&
            emptyPointSettings.mode != EmptyPointMode.gap) &&
        isEmpty(index);

  pointStartAngle = pointEndAngle;
}