drawNoDataIcon method

  1. @protected
  2. @override
void drawNoDataIcon(
  1. Canvas canvas,
  2. MutableRect bounds,
  3. ChartPaint paint
)
override

Draws two nested hexagons, the outline of a web, inside bounds for the empty state.

Implementation

@protected
@override
void drawNoDataIcon(ui.Canvas canvas, MutableRect bounds, ChartPaint paint) {
  paint.style = PaintStyle.STROKE;
  paint.strokeWidth = bounds.height() / 12;
  paint.strokeJoin = ui.StrokeJoin.round;
  final outer = (bounds.height() - paint.strokeWidth) / 2;
  for (final radius in Float32List.fromList([outer, outer * 0.5])) {
    final path = ui.Path();
    for (var i = 0; i <= 5; i++) {
      final angle = (60.0 * i - 90.0) * Utils.DEG2RAD;
      final x = bounds.centerX() + radius * math.cos(angle);
      final y = bounds.centerY() + radius * math.sin(angle);
      if (i == 0) {
        path.moveTo(x, y);
      } else {
        path.lineTo(x, y);
      }
    }
    path.close();
    canvas.drawPathP(path, paint);
  }
}