ChartCanvas extension

The android.graphics.Canvas calls of the renderers, drawing with a ChartPaint.

PaintStyle.FILL_AND_STROKE draws a fill pass and then a stroke pass. A ChartPaint.pathEffect dashes lines and strokes as Skia does; fills are never dashed. Its lengths are device px, as on Android: they are divided by Utils.devicePixelRatio when the line is dashed. Android's val n = c.save(); …; c.restoreToCount(n) becomes final n = c.getSaveCount(); c.save(); …; c.restoreToCount(n).

A line, rectangle or circle with a NaN coordinate or radius, and text anchored at a NaN position, is not drawn: Skia draws nothing for it, while Flutter's canvas asserts on it in debug builds. Infinite coordinates are drawn as Flutter draws them. A circle with a radius of 0 or less is not drawn either, as Android's canvas does.

on

Methods

clipRectM(MutableRect rect) → void

Available on Canvas, provided by the ChartCanvas extension

Intersects the clip with rect, without antialiasing like Android's rectangle clip, like Canvas.clipRect(RectF).
drawCircleP(double cx, double cy, double radius, ChartPaint paint) → void

Available on Canvas, provided by the ChartCanvas extension

Draws a circle around (cx, cy) with radius in the style of paint, like Canvas.drawCircle.
drawColorP(Color color) → void

Available on Canvas, provided by the ChartCanvas extension

Fills the clip with color blended source over, like Canvas.drawColor(int).
drawLineP(double x1, double y1, double x2, double y2, ChartPaint paint) → void

Available on Canvas, provided by the ChartCanvas extension

Draws a line from (x1, y1) to (x2, y2), always stroked, like Canvas.drawLine.
drawLinesP(Float32List pts, int offset, int count, ChartPaint paint) → void

Available on Canvas, provided by the ChartCanvas extension

Draws count floats of pts from offset as separate lines, four floats (x0, y0, x1, y1) per line, always stroked, like Canvas.drawLines(pts, offset, count, paint). Floats past the last whole line are ignored. With a dash effect every line starts the pattern anew, as in Skia.
drawPathP(Path path, ChartPaint paint) → void

Available on Canvas, provided by the ChartCanvas extension

Draws path in the style of paint, its stroke dashed when ChartPaint.pathEffect is set, like Canvas.drawPath.
drawRectP(MutableRect rect, ChartPaint paint) → void

Available on Canvas, provided by the ChartCanvas extension

Draws rect in the style of paint, like Canvas.drawRect(RectF, Paint).
drawRoundRectP(MutableRect rect, double rx, double ry, ChartPaint paint) → void

Available on Canvas, provided by the ChartCanvas extension

Draws rect with corners of radii rx and ry in the style of paint, like Canvas.drawRoundRect.
drawText(String text, double x, double y, ChartPaint paint) → void

Available on Canvas, provided by the ChartCanvas extension

Draws text with its baseline at y; ChartPaint.textAlign says whether x is its left edge, center or right edge, like Canvas.drawText(text, x, y, paint).
saveCount() → int

Available on Canvas, provided by the ChartCanvas extension

The number of saved states on the stack, like Canvas.getSaveCount().