customizeSegment method

  1. @override
void customizeSegment(
  1. ChartSegment segment
)
override

Changes the series color, border color, and border width.

Implementation

@override
void customizeSegment(ChartSegment segment) {
  final WaterfallSegment<T, D> waterfallSegment =
      segment as WaterfallSegment<T, D>;
  final int index = waterfallSegment.currentSegmentIndex;
  Color? color;
  if (_intermediateSumValues[index] && intermediateSumColor != null) {
    color = intermediateSumColor;
  } else if (_totalSumValues[index] && totalSumColor != null) {
    color = totalSumColor;
  } else if (yValues[index] < 0 && negativePointsColor != null) {
    color = negativePointsColor;
  }

  updateSegmentColor(waterfallSegment, borderColor, borderWidth,
      fillColor: color);
  updateSegmentGradient(waterfallSegment,
      gradientBounds: waterfallSegment.segmentRect?.outerRect,
      gradient: gradient,
      borderGradient: borderGradient);

  segment.connectorLineStrokePaint
    ..color = connectorLineSettings.color ??
        chartThemeData!.waterfallConnectorLineColor
    ..strokeWidth = connectorLineSettings.width;
}