Skip to content

ScatterPlot

Overview

Renders a dataset of Vector2[] using circles.

@author Sam Reid (PhET Interactive Simulations)

Class ScatterPlot

import { ScatterPlot } from 'scenerystack/bamboo';

Constructor

new ScatterPlot( chartTransform : ChartTransform, dataSet : Vector2[], providedOptions? : ScatterPlotOptions )

Instance Methods

setDataSet( dataSet : Vector2[] )

Sets the dataSet and redraws the plot. If instead the dataSet array is mutated, it is the client's responsibility to call update or make sure update is called elsewhere (say, if the chart scrolls in that frame).

update()

Recomputes the rendered shape.

dispose()

Instance Properties

dataSet : Vector2[]

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

Type ScatterPlotOptions

TODO https://github.com/phetsims/bamboo/issues/63 If 'fill' and 'stroke' are different, overlapping points will not look correct.

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

Source Code

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