onPaint method

  1. @override
void onPaint(
  1. Canvas canvas
)
override

Draws segment in series bounds.

Implementation

@override
void onPaint(Canvas canvas) {
  _setSegmentProperties();
  final SeriesRendererDetails seriesRendererDetails =
      SeriesHelper.getSeriesRendererDetails(
          _segmentProperties.seriesRenderer);
  final bool isDashArray = seriesRendererDetails.dashArray![0] != 0 &&
      seriesRendererDetails.dashArray![1] != 0;
  if ((seriesRendererDetails.series.emptyPointSettings.mode ==
              EmptyPointMode.gap &&
          seriesRendererDetails.containsEmptyPoints) ||
      isDashArray) {
    isDashArray
        ? drawDashedLine(canvas, _segmentProperties.series.dashArray,
            strokePaint!, seriesRendererDetails.segmentPath!)
        : canvas.drawPath(seriesRendererDetails.segmentPath!, strokePaint!);
  } else {
    canvas.drawPoints(PointMode.polygon, points, strokePaint!);
  }
}