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 radius = _sizes[index];
  if (radius.isNaN || sizeValueMapper == null) {
    radius = minimumRadius;
  } else {
    final num sizeDelta = _maxBubbleSize - _minBubbleSize;
    if (sizeDelta == 0) {
      radius = radius == 0 ? minimumRadius : maximumRadius;
    } else {
      final num radiusDiff = maximumRadius - minimumRadius;
      radius = minimumRadius + radiusDiff * (radius / _maxBubbleSize);
    }
  }

  segment as BubbleSegment<T, D>
    ..series = this
    ..x = xValues[index]
    ..y = yValues[index]
    ..radius = radius
    ..isEmpty = isEmpty(index);
}