/docsfor

Axes and scales

Opt-in value axes, explicit tick ladders, log scales, target lines, and guides.

A chart with no value axis is a legitimate default here. Ticks are opt-in through yTicks and xTicks, which take either a count or an explicit ladder.

ValueResult
unsetNo value axis
4Four intervals on the 1, 2, 5 ladder inside the chart's own domain
[{ at, label }]Exactly those ticks; they widen the domain to include themselves

Labels come from the chart's format, and the widest printed label sizes the gutter, so a six-digit axis is not cut and a two-digit one does not waste the plot.

Cumulative stars1k10k41.8kM1M2M3M4M5M6M7M8M9M10M11M12
fig. 01 · yScale="log" with a count of ticks, which counts in decades
Weekly deploys0102030goalW1W2W3W4W5W631W7W8
fig. 02 · An explicit tick ladder and a target line
p95 latency, ms0100200300SLOdeploy24800:0002:0004:0006:0008:0010:0012:0014:0016:0018:0020:0022:00
fig. 03 · guides on both axes: a threshold in data units and a release in index units

Log scales

Line, Area, Scatter, ConnectedScatter, Histogram, Hexbin, Contour, Column, and Bar take xScale or yScale of "log". A tick count on log paper counts decades, because a linear ladder on log paper lands on nothing.

<Line labels={months} data={stars} yScale="log" yTicks={3} format={formatCompact} />

Targets and guides

Column and Bar take a target reference line with an optional label. Most value-axis forms take guides, a list of { at, axis, label } lines for thresholds such as an SLO or a release. A guide sits on the value axis by default, in data units; axis: "x" puts it on the category axis, in index units or in xs units when the chart has them. A guide widens the domain to include itself.

<Column items={deploys} target={{ at: 25, label: "goal" }} highlight="max" />
<Line
  labels={hours}
  data={p95}
  guides={[
    { at: 300, label: "SLO" },
    { at: 7, axis: "x", label: "deploy" },
  ]}
/>

The same numbers elsewhere

The tick math is exported: niceTicks, decadeTicks, resolveTicks, niceStep, and upperBound. Use them when a table header or a legend needs the same numbers the chart prints.