onPaint method
Draws segment in series bounds.
Implementation
@override
void onPaint(Canvas canvas) {
final WaterfallSeries<dynamic, dynamic> _series =
this._series as WaterfallSeries<dynamic, dynamic>;
CartesianChartPoint<dynamic> oldPaint;
final Path linePath = Path();
if (fillPaint != null) {
(_series.animationDuration > 0 &&
!_seriesRenderer._chartState!._isLegendToggled)
? _animateRangeColumn(
canvas,
_seriesRenderer,
fillPaint!,
segmentRect,
_oldPoint != null ? _oldPoint!.region : _oldRegion,
animationFactor)
: canvas.drawRRect(segmentRect, fillPaint!);
}
if (strokePaint != null) {
if (_series.dashArray[0] != 0 && _series.dashArray[1] != 0) {
_drawDashedLine(canvas, _series.dashArray, strokePaint!, _path);
} else {
(_series.animationDuration > 0 &&
!_seriesRenderer._chartState!._isLegendToggled)
? _animateRangeColumn(
canvas,
_seriesRenderer,
strokePaint!,
segmentRect,
_oldPoint != null ? _oldPoint!.region : _oldRegion,
animationFactor)
: canvas.drawRRect(segmentRect, strokePaint!);
}
}
if (connectorLineStrokePaint != null &&
_currentPoint!.overallDataPointIndex! > 0) {
oldPaint = _seriesRenderer
._dataPoints[_currentPoint!.overallDataPointIndex! - 1];
_x1 = oldPaint.endValueRightPoint!.x;
_y1 = oldPaint.endValueRightPoint!.y;
if (_currentPoint!.isTotalSum! || _currentPoint!.isIntermediateSum!) {
_x2 = _currentPoint!.endValueLeftPoint!.x;
_y2 = _currentPoint!.endValueLeftPoint!.y;
} else {
_x2 = _currentPoint!.originValueLeftPoint!.x;
_y2 = _currentPoint!.originValueLeftPoint!.y;
}
if (_series.animationDuration <= 0 ||
animationFactor >=
_seriesRenderer._chartState!._seriesDurationFactor) {
if (_series.connectorLineSettings.dashArray![0] != 0 &&
_series.connectorLineSettings.dashArray![1] != 0) {
linePath.moveTo(_x1, _y1);
linePath.lineTo(_x2, _y2);
_drawDashedLine(canvas, _series.connectorLineSettings.dashArray!,
connectorLineStrokePaint!, linePath);
} else {
canvas.drawLine(
Offset(_x1, _y1), Offset(_x2, _y2), connectorLineStrokePaint!);
}
}
}
}