Paints one pane's series. One instance per pane: a backend holds a context on that pane's base canvas, and contexts do not travel between canvases.

Implements

Constructors

Properties

device: GlDevice

The GPU device behind the backend, when it has one. The chart reads it after a frame (backendDegradation) to learn that the context has been lost or never came up, and moves every pane to canvas2d for the rest of the session, announced by the 'renderer:fallback' chart event. A backend without a device is never degraded, so the 2D backend leaves it unset.

kind: "webgl2" = 'webgl2'

Accessors

Methods

  • Paint one series. Same contract as RendererEntry.draw minus the context: priceToY and items[].x are media px, and the renderer snaps to device pixels with dpr itself.

    items and the objects in it belong to the pane, which rewrites them in place the next time it draws this series, so a backend that keeps any of it past that (a batch held across frames, say) copies what it keeps.

    Parameters

    Returns void

  • Take the pane's base data canvas. ctx2d is the 2D context the pane already holds on it, when it holds one: the canvas-2D backend draws on exactly that object, so a frame is one context's op stream and not two contexts' interleaved. A backend that owns the canvas outright ignores it.

    Parameters

    • canvas: HTMLCanvasElement
    • ctx2d: null | CanvasRenderingContext2D

    Returns void

  • A 2D context for what the backend does not draw natively (grid, axes, primitives), or null when the backend paints those itself.

    Returns null | CanvasRenderingContext2D

  • The pane sized its own canvas already; only the shared surface has to keep up.

    Parameters

    • widthPx: number
    • heightPx: number
    • dpr: number

    Returns void