paint method

  1. @override
void paint(
  1. Context context
)
override

Draw itself and its children, according to the calculated box.offset

Implementation

@override
void paint(Context context) {
  super.paint(context);

  if (data.isEmpty) {
    return;
  }

  final grid = Chart.of(context).grid;

  if (drawSurface) {
    for (final value in data) {
      _drawSurface(context, grid, value);
    }

    if (surfaceOpacity != 1) {
      context.canvas
        ..saveContext()
        ..setGraphicState(
          PdfGraphicState(opacity: surfaceOpacity),
        );
    }

    context.canvas
      ..setFillColor(color)
      ..fillPath();

    if (surfaceOpacity != 1) {
      context.canvas.restoreContext();
    }
  }

  if (drawBorder) {
    for (final value in data) {
      _drawSurface(context, grid, value);
    }

    context.canvas
      ..setStrokeColor(borderColor ?? color)
      ..setLineWidth(borderWidth)
      ..strokePath();
  }
}