LinePlot¶
Overview¶
LinePlot renders a {Array.<Vector2|null>} dataSet by connecting the points with line segments.
Null values are skipped and allow you to create gaps in a plot. Examples: dataset [ (0,0), (0,1), (0,2), (0,3) ] => 3 lines segments, connecting consecutive points dataset [ (0,0), (0,1), null, (0,2), (0,3) ] => 2 lines segments, connecting the first 2 and last 2 points
@author Sam Reid (PhET Interactive Simulations)
Class LinePlot¶
Constructor¶
new LinePlot( chartTransform : ChartTransform, dataSet : ( Vector2 | null )[], providedOptions? : LinePlotOptions )¶
Instance Methods¶
setDataSet( dataSet : ( Vector2 | null )[] )¶
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 | null )[]¶
if you change this directly, you are responsible for calling update
Type LinePlotOptions¶
Source Code¶
See the source for LinePlot.ts in the bamboo repository.