Documentation / @finchart/dom / PlotBuilder
Class: PlotBuilder<T>
Defined in: dom/src/builder.ts:14
Type Parameters
T
T extends BaseDataPoint
Methods
addDataPoint()
addDataPoint(
point):this
Defined in: dom/src/builder.ts:48
Parameters
point
T
Returns
this
addDataPoints()
addDataPoints(
points):this
Defined in: dom/src/builder.ts:53
Parameters
points
T[]
Returns
this
build()
build(
container):Plot
Defined in: dom/src/builder.ts:128
Builds the chart.
Series and data go in as a single registration — the registration owns the data, so there's nowhere else to put it. If you need to swap the data later, use plot.mainPane.addSeries() instead of the builder.
Why mount happens after building: the constructor can't be generic, so it would lose the point type, but addSeries is generic on the method, so T carries through intact.
Parameters
container
HTMLElement
Returns
Plot
setAxis()
setAxis(
axis):this
Defined in: dom/src/builder.ts:69
x is shared by every pane; y becomes each pane's default.
Parameters
axis
{ x?: XAxisOptions; y?: YAxisOptions; } | undefined
Returns
this
setFormat()
setFormat(
format):this
Defined in: dom/src/builder.ts:78
Turns tick values into display strings (dates, currency, etc.).
Parameters
format
x?
(value) => string
y?
(value) => string
Returns
this
setGridStyle()
setGridStyle(
grid):this
Defined in: dom/src/builder.ts:94
Grid style. Series style is passed when the series is created.
Parameters
grid
Partial<LineStyle>
Returns
this
setPadding()
setPadding(
padding):this
Defined in: dom/src/builder.ts:88
Parameters
padding
Padding | undefined
Returns
this
setScope()
setScope(
scope):this
Defined in: dom/src/builder.ts:112
A parent lifetime to live under — disposing the scope destroys the chart. The builder-path twin of PlotOptions.scope: a page-level scope can own several charts plus their sibling subscriptions (theme observation, sync links, sockets), and one dispose() walks out of all of it. Destroying the chart yourself first leaves the parent a no-op.
Parameters
scope
Scope
Returns
this
setShowAxisLabels()
setShowAxisLabels(
show):this
Defined in: dom/src/builder.ts:64
Both axes. To turn off just one, use setAxis.
Parameters
show
boolean
Returns
this
setShowGrid()
setShowGrid(
show):this
Defined in: dom/src/builder.ts:58
Parameters
show
boolean
Returns
this
setSize()
setSize(
width,height):this
Defined in: dom/src/builder.ts:100
Initial size of the layers. Change it later with plot.setViewport().
Parameters
width
number
height
number
Returns
this
create()
staticcreate<T>(deps,series?):PlotBuilder<T>
Defined in: dom/src/builder.ts:41
The data type T is fixed by both deps and series.
PlotBuilder.create(browserDeps(), candleSeries()).setSize(800, 600).build(el)
browserDeps() is a recipe waiting for a container, so build(el) feeds it el to complete the wiring. Pass an already-built PlotDeps instead and el never enters the wiring.
Passing series here means you don't get a handle back. If you need live updates (updateLast) or an indicator input (source), don't pass a series — mount it with plot.mainPane.addSeries(...) instead, which does return a handle. This argument is the shortcut for "just show one candlestick series."
Type Parameters
T
T extends BaseDataPoint
Parameters
deps
PlotDeps | BrowserDeps
series?
Series<T>
Returns
PlotBuilder<T>