Skip to content

ChartCanvasNode

Overview

ChartCanvasNode renders to a canvas. It is usually preferable to use the other scenery Node-based renderers, but this one can be necessary for performance-critical charts.

@author Sam Reid (PhET Interactive Simulations)

Class ChartCanvasNode

import { ChartCanvasNode } from 'scenerystack/bamboo';

Constructor

new ChartCanvasNode( chartTransform : ChartTransform, painters : CanvasPainter[], providedOptions? : StrictOmit<CanvasNodeOptions, 'canvasBounds'> )

Instance Methods

setPainters( painters : CanvasPainter[] )

Sets the painters and redraws the chart.

update()

paintCanvas( context : CanvasRenderingContext2D )

Used to redraw the CanvasNode. Use CanvasNode.invalidatePaint to signify that it is time to redraw the canvas.

dispose()

Instance Properties

painters : CanvasPainter[]

if you change this directly, you are responsible for calling update

Type ChartCanvasNodeOptions

import type { ChartCanvasNodeOptions } from 'scenerystack/bamboo';

CanvasNodeOptions

Source Code

See the source for ChartCanvasNode.ts in the bamboo repository.