Skip to content

Plot

Plot(props): ReactElement

Defined in: react/Plot.tsx:111

The declarative non-geo plotting component. It wraps the imperative plot engine: an effect keyed on [width, height] creates the engine ONCE, reads its <Layer> / <Points> children and applies them as engine.layer / engine.points calls (sibling order = paint order), optionally enables zoom, renders, and calls onReady(engine). A [backend] effect calls engine.setBackend() (preserving the current zoom/pan and layers — no recreate). A children-change effect re-applies the layers/points to the live engine so content updates keep the current view.

<Plot width={w} height={h} backend={backend} zoom={[0.5, 40]} onReady={register}>
<Layer name="links" data={links} draw={(ctx, l) => { gen.context(ctx); gen(l); }} stroke="#555" />
<Points name="nodes" data={tips} x={(n) => n.y} y={(n) => n.x} radius={2.6} fill={colorOf} />
</Plot>

PlotProps

ReactElement