customizeSegment method Null safety

  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 waterfallSegment = segment as WaterfallSegment;
  final SegmentProperties segmentProperties =
      SegmentHelper.getSegmentProperties(segment);
  segmentProperties.color =
      SeriesHelper.getSeriesRendererDetails(segmentProperties.seriesRenderer)
          .seriesColor;
  segmentProperties.negativePointsColor =
      _waterfallSeries.negativePointsColor;
  segmentProperties.intermediateSumColor =
      _waterfallSeries.intermediateSumColor;
  segmentProperties.totalSumColor = _waterfallSeries.totalSumColor;
  segmentProperties.strokeColor = segmentProperties.series.borderColor;
  segmentProperties.strokeWidth = segmentProperties.series.borderWidth;
  waterfallSegment.strokePaint = waterfallSegment.getStrokePaint();
  waterfallSegment.fillPaint = waterfallSegment.getFillPaint();
  waterfallSegment.connectorLineStrokePaint =
      segmentProperties.getConnectorLineStrokePaint();
}