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 ScatterSegment scatterSegment = segment as ScatterSegment;
  final SegmentProperties segmentProperties =
      SegmentHelper.getSegmentProperties(scatterSegment);
  segmentProperties.color =
      SeriesHelper.getSeriesRendererDetails(segmentProperties.seriesRenderer)
          .seriesColor;
  segmentProperties.strokeColor = segmentProperties.series.borderColor;
  segmentProperties.strokeWidth =
      ((segmentProperties.series.markerSettings.shape ==
                      DataMarkerType.verticalLine ||
                  segmentProperties.series.markerSettings.shape ==
                      DataMarkerType.horizontalLine) &&
              segmentProperties.series.borderWidth == 0)
          ? segmentProperties.series.markerSettings.borderWidth
          : segmentProperties.series.borderWidth;
  scatterSegment.strokePaint = scatterSegment.getStrokePaint();
  scatterSegment.fillPaint = scatterSegment.getFillPaint();
}