calculateEmptyPointValue method
void
calculateEmptyPointValue(
- int pointIndex,
- dynamic currentPoint,
- dynamic seriesRenderer
inherited
To calculate empty point values if null values are provided.
Implementation
@override
void calculateEmptyPointValue(
int pointIndex, dynamic currentPoint, dynamic seriesRenderer) {
final List<PointInfo<dynamic>> dataPoints = seriesRenderer.dataPoints;
final EmptyPointSettings empty = emptyPointSettings;
final int pointLength = dataPoints.length;
final PointInfo<dynamic> point = dataPoints[pointIndex];
if (point.y == null) {
switch (empty.mode) {
case EmptyPointMode.average:
final num previous =
pointIndex - 1 >= 0 ? dataPoints[pointIndex - 1].y ?? 0 : 0;
final num next = pointIndex + 1 <= pointLength - 1
? dataPoints[pointIndex + 1].y ?? 0
: 0;
point.y = (previous + next).abs() / 2;
point.isVisible = true;
point.isEmpty = true;
break;
case EmptyPointMode.zero:
point.y = 0;
point.isVisible = true;
point.isEmpty = true;
break;
case EmptyPointMode.drop:
case EmptyPointMode.gap:
point.isEmpty = true;
point.isVisible = false;
break;
}
}
}