drawNoDataIcon method
Draws the outline of this chart type that the empty state shows above its text, inside bounds, with
paint in noDataIconColor. The default draws three bars; line, pie, radar, scatter and bubble charts draw
their own shape.
Implementation
@protected
@override
void drawNoDataIcon(ui.Canvas canvas, MutableRect bounds, ChartPaint paint) {
paint.style = PaintStyle.STROKE;
paint.strokeWidth = bounds.height() / 8;
paint.strokeCap = ui.StrokeCap.round;
paint.strokeJoin = ui.StrokeJoin.round;
final inset = paint.strokeWidth / 2;
final ys = Float32List.fromList([0.8, 0.45, 0.65, 0.15]);
final path = ui.Path();
for (var i = 0; i < ys.length; i++) {
final x =
bounds.left +
inset +
(bounds.width() - 2 * inset) * i / (ys.length - 1);
final y = bounds.top + inset + (bounds.height() - 2 * inset) * ys[i];
if (i == 0) {
path.moveTo(x, y);
} else {
path.lineTo(x, y);
}
}
canvas.drawPathP(path, paint);
}