Elicit.js

Radial axis

axisRadial() draws the theta scale as a radial axis: an arc spine, ticks, labels, and optional coloured bands for categories. The arc spans the theta scale's range, by default [180, 0]: left to right through the top. channel: 'radius' draws the radius scale as concentric rings instead. The axis is inert; pair it with a needle to take an answer.

API reference

axisRadial(options)

Import elements from elicitjs. A curved axis for a polar scale: an arc spine with ticks and labels, and optional coloured bands behind it. It takes no edits: edit, edits, field and table warn.

axisRadial({ channel, outerRadius, bands, ticks, tickPadding, fill, … }) → ChartElement
Options
OptionType · defaultDescription
channel
'theta' | 'radius'default'theta'
Which scale to read. 'radius' draws concentric rings at the radius scale’s ticks, the key for an arc with a radius channel.
outerRadius
numberdefault42% of min(w,h)
Arc radius in px. The arc spans the theta scale’s range. Ignored with channel: 'radius', whose rings sit at the scale’s own extent.
bands
booleandefaultfalse
Fill annular sectors for discrete domains (categorical gauge chrome).
bandWidth
numberdefault18
Radial thickness of coloured bands when innerRadius is 0.
innerRadius
numberdefault0
Inner radius of band rings (donut-style chrome).
ticks / tickValues / tickFormat
…default5
Same tick helpers as Cartesian axes. ticks: 0 draws labels only; tickFormat takes a d3-format string or a function.
tickSize / tickPadding
numberdefaulttheme (6) / 14
Tick length (px, inward) and label distance beyond the rim.
fontSize / fill
…defaulttheme (10 / '#374151')
Tick-label size and colour.
stroke / strokeWidth
…defaulttheme ('#6b7280') / 1.25
Spine and tick colour, and width. Unset options take the theme’s axis tokens, as on axis.
title
string
A caption for the axis.
channels
objectdefault{}
Placement only — x/y for one ring per row, and fill for band colour. An element views a scale, so this is chrome, not encoding.
id
string
Stable identity, as on every mark.
Channels
ChannelTypeDescription
theta
linear | point
Usually shares the needle’s theta field + range.
fill
ordinal
Colours categorical bands when bands: true. Set a palette with scale: { scheme: "…" } (add reverse: true to flip) or scale: { range: [...] }.
x / y
linear | point
Optional centre (default: plot centre). When bound to fields, one ring is drawn per row (small-multiple needles).
Returns / emits

A chart element emitting background path/line/text nodes.

Continuous radial ticks

A quantitative theta scale gets a spine and tick marks. theta is the polar angular position, which is what a needle encodes. angle, a mark's rotation in place, has no axis.

Semi-circle axis

No needle — just the chrome. 0 on the left, 100 on the right.

const chart = Elicit({
width: 300, height: 180,
margins: { top: 28, right: 20, bottom: 20, left: 20 },
axes: false,
data: [{ n: 50 }],
schema: { n: { type: "quantitative", domain: [0, 100] } },
marks: [
axisRadial({
outerRadius: 90, ticks: 6, title: "score",
channels: { theta: { field: "n", scale: { range: [180, 0] } } },
}),
],
});
mount(chart.dom());

Coloured categorical bands

A discrete domain gets one annular sector per category, coloured by an ordinal fill.

Banded likelihood arc

Seven categories across a top-facing semicircle, coloured by the reversed `dddiverging` scheme (blue→coral).

const chart = Elicit({
width: 360, height: 210,
margins: { top: 36, right: 64, bottom: 16, left: 64 },
axes: false,
overflow: "visible", // long labels spill into the margin
data: [{ chance: "TOSSUP" }],
schema: {
chance: {
type: "ordinal",
domain: ["VERY LIKELY D", "LIKELY D", "LEANING D", "TOSSUP",
"LEANING R", "LIKELY R", "VERY LIKELY R"],
},
},
marks: [
axisRadial({
outerRadius: 110, bands: true, bandWidth: 28,
tickPadding: 16, fontSize: 8,
channels: {
theta: { field: "chance", scale: { range: [180, 0] } },
// RdBu is red→blue natively; reverse for the D→R (blue→red) reading.
fill: { field: "chance", scale: { scheme: "dddiverging", reverse: true } },
},
}),
],
});
mount(chart.dom());

Tick + label customization

Ticks take the same options as Cartesian axes: ticks (a count), tickValues (explicit values), and tickFormat (a d3-format string or function). Style labels with fontSize and fill, and the spine with stroke, as on axis. Unset, they take the theme's axis tokens.

Percent ticks at chosen values

Explicit tickValues, a percent tickFormat, and a custom label colour.

const chart = Elicit({
width: 300, height: 190,
margins: { top: 30, right: 24, bottom: 16, left: 24 },
axes: false,
overflow: "visible",
data: [{ p: 0.5 }],
schema: { p: { type: "quantitative", domain: [0, 1] } },
marks: [
axisRadial({
outerRadius: 95,
tickValues: [0, 0.25, 0.5, 0.75, 1],
tickFormat: ".0%",
fill: "#50AEB7", fontSize: 11,
stroke: "#B7DEE1", tickSize: 8,
channels: { theta: { field: "p", scale: { range: [180, 0] } } },
}),
],
});
mount(chart.dom());

Rings for a radius scale

axisRadial({ channel: 'radius' }) reads the radius scale instead of theta. It draws a concentric ring at each tick, labelled up the vertical. Use it to key an arc whose slices take their rim from a radius field. The rings span the scale's own extent, from the arc's innerRadius to its outerRadius, so the axis's outerRadius option has no effect. ticks, tickValues and tickFormat work as on the angular axis.

Rings for a radius scale

axisRadial({ channel: "radius", ticks: 4 }) behind an arc with radius: { field: "n" }.

const chart = Elicit({
width: 300, height: 280,
margins: { top: 16, right: 16, bottom: 16, left: 16 },
axes: false,
data: [
{ month: "Jan", n: 30 }, { month: "Feb", n: 45 }, { month: "Mar", n: 70 },
{ month: "Apr", n: 90 }, { month: "May", n: 60 }, { month: "Jun", n: 40 },
],
schema: {
month: { type: "categorical" },
n: { type: "quantitative", domain: [0, 100] },
},
elements: [
// Concentric rings at the radius scale's ticks, labelled up the vertical.
axisRadial({ channel: "radius", ticks: 4, tickFormat: "d" }),
],
marks: [
arc({
outerRadius: 110, padAngle: 1.5,
channels: {
theta: { value: 1 },
radius: { field: "n" },
fill: { field: "month" },
},
}),
],
});
mount(chart.dom());