Skip to content

Blocks

Blocks are the pieces of a slat. For a bulk scatter collection directly inside a Chart, use ManyDots. Values are on the chart’s scale. Every block also takes class, style (an object), ref, color, children, event handlers (onClick…) and HTML attributes (title, data-*, aria-*).

color is a theme name ("series-1" to "series-6", "positive", "negative", "ink", "muted", "grid", "surface", "low", "high") or any CSS color.

Bar, Dot, Tick, Label and Cell also take shape: an outline from shape() to draw instead of their rectangle (a Dot’s circle).

Bar

<Bar from={2} to={d.value} thick="10px" />
PropDefault
from0where the bar starts
to0where it ends. Below from, the bar runs backward.
thickthe band less a margina size ("10px") or a share of the band (0.5)
colorseries-1

Dot

<Dot at={d.value} size="14px" />
PropDefault
atits value
size"10px"its diameter
across0.5where it sits across the band, from 0 to 1
crossits value on the chart’s second axis, instead of across
colorseries-1

ManyDots

ManyDots draws one plain HTML point per data row, without a slat or rendering computation for each point. Place the collection directly inside a Chart with a cross scale.

<Chart scale={[0, 100]} cross={[0, 100]}>
  <ManyDots rows={samples} at={row => row.x} cross={row => row.y} key={row => row.id} />
</Chart>

Colors, sizes, shapes, classes, and styles can vary by point. Native hover, click, touch, and drag events remain available through collection handlers or event delegation. The dedicated ManyDots reference covers its props, a live example, source-build availability, and its differences from Dot.

Tick

<Tick at={d.goal} thick={0.8} />
PropDefault
atits value
thickthe band less a marginits length across the band
colorink

Label

<Label at={d.value}>{d.value}</Label>
<Label edge="start">{d.name}</Label>
Prop
ata valuethe text starts just past it
side"before"with at: the text ends just before the value instead
edge"start" or "end"outside the chart: before it (names) or after it
crossa valuewith at: its place on the chart’s second axis

Cell

<Cell value={h.count} />
Prop
valuecolored from the theme’s low (at the scale’s min) to high (at its max)
colora fixed color instead

Place

<Place at={d.value}><span class="badge">{d.value} kg</span></Place>

Draws nothing: no size, no color. What you put inside it sits at its value.

PropDefault
atits value
across0.5where it sits across the band, from 0 to 1
crossits value on the chart’s second axis, instead of across

Area

<Area points={[[7, 1], [9, 4], [12, 7], [19, 1]]} mirror />
PropDefault
points[value, height] pairs, sorted by value
peakthe largest heightthe height that fills the band
mirrorfalsedraw both ways from the band’s middle (violins)
smoothfalsejoin the points with curves instead of straight lines
colorseries-1

Line

<Line points={[[1, 320], [2, 280], [3, 350], [4, 300]]} peak={400} fill />
PropDefault
points[value, y] pairs. Out of the value’s order, they make a connected scatter plot.
peakthe largest yin a slat: the y that reaches the top of the band
fillfalsefill under the line: to the band’s edge, or on a second axis down to base
base0on a second axis: where the fill ends
smoothfalsejoin the points with curves instead of straight lines
colorseries-1

In a slat, a Line is a sparkline across the band. On a chart with a second axis, its y is on that axis.