onDraw method

void onDraw(
  1. Canvas canvas
)

Draws the chart onto canvas, whose origin is the top left corner of the chart, View.onDraw.

The base draws the empty state while there is nothing to draw (and then calls notifyAfterDraw) and otherwise calculates the offsets once; subclasses draw the rest and call notifyAfterDraw at their end.

Implementation

void onDraw(ui.Canvas canvas) {
  if (showsEmptyState) {
    drawEmptyState(canvas);
    // Not in Kotlin, see afterDrawListeners.
    notifyAfterDraw();
    return;
  }

  if (!_offsetsCalculated) {
    calculateOffsets();
    _offsetsCalculated = true;
  }
}