Support Table (chart.support_table)¶
An optional mini data-grid attached to a chart, with columns
pixel-aligned to the chart's x-axis ticks. The strip position is
controlled by style.charts.support_table.position (top or bottom);
the default is top (strip above the plot, Excel-style). Direct Excel
analog: "Chart Element → Data Table."
chart: type: bar x: month y: revenue support_table: - source: sample_size format: ",d" label: "n" - aggregate: sum source: revenue format: currency label: "Total"
Each list entry is a row. Columns align to the chart's x-axis ticks.
When label: is omitted on a source or aggregate row, the row stub is derived
from source: (successful_launches renders as Successful Launches).
Missing, non-finite, or invalid cell values render as a regular dash (-), not as
JavaScript sentinel text such as NaN or null.
When format: is omitted, a row reading the chart's primary measure column
takes the y-axis label format, and any other row takes its column's format from
the query's formats:, so the chart and strip do not show the same measure with
different number formatting. A numeric row with neither takes the compact
number format (9.51k), the way a legend labels its values; a column of years
prints them as years, and a text column prints as written. A count or count_distinct row counts rows, so it never
takes its column's query format.
The unit is stated once, not on every cell¶
When a row's format: is a predefined name that carries a unit (such as
currency or percent) the strip
states that unit on its leftmost cell and leaves the rest bare, so the row
reads as one measurement instead of repeating itself:
The whole row shares one magnitude, chosen from its own values, so cells never
disagree about scale the way per-cell formatting can (993k beside 1.0M).
A row whose values outgrow that magnitude repeats the suffix on every cell;
a currency symbol is still stated once, since repeating it disambiguates
nothing.
A vertical block (beside a horizontal bar) reads like a table column: a unit
stated once takes the analytic form ($2.35M), a repeated one the narrative
form (2.35m).
Nothing is authored for this: the unit comes from the format: you already
write, and a format naming no unit is untouched. A sorted category axis
(an authored sort:, or a horizontal bar's largest-first default) states the
unit on the first cell in its sorted order. Two shapes keep the older
per-cell spelling, because the leftmost painted cell cannot be
identified:
| Shape | Why |
|---|---|
a raw d3 format literal (for example, "$.2s"), or a style.formats alias to one |
only engine-predefined format names engage the anchor |
| a quantitative x axis | continuous, so the leftmost band is not the first row |
A strip is a table: a digits column and a unit column. A strip has one cell
width, set by its widest value across every row and bucket plus room for the
widest unit, and each cell sits in the cell of its x-axis label on every chart
type: centered under a centered label (on a date axis that names months over
weekly buckets, that is the middle of the month), starting where a label flushed
to the plot's left edge starts, and ending where one flushed to its right edge
ends. Inside the cell, every number's digits end at the same right edge, whichever
side the y-axis is on, and whatever follows the last digit (k, m, %) sits in
the unit column past that edge: $280k sits over 283 with 280 over 283 and
the k sticking out, and 9.51 of 9.51k sits over 206. Numbers are never
padded to line up their decimals, so 3.3 sits flush over 283. Set
repeat: anchor or repeat: every on the format to choose where the unit
appears. axis_y.position defaults to auto and resolves
to left whenever a chart draws endpoint labels, which multi-series line, area,
and bar charts do by default.
Entry shapes¶
Two shapes, one of each per list entry:
| Shape | Keys | When to use |
|---|---|---|
| Source row | source: (required), format:, label: |
Read a raw per-x value from a query column. label: defaults from source: when omitted. |
| Aggregate row | aggregate: + source: (both required), format:, label: |
Compute a per-x aggregate across other dimensions (for example, segment-stacked bars). label: defaults from source: when omitted. |
A source row with no format:/label: override may be written as a bare
column name; - revenue is shorthand for - {source: revenue}, the same
scalar-listable spelling y: uses:
rows: - type: bar query: q x: month y: revenue support_table: - revenue - cost
Supported aggregate operations¶
sum, avg, min, max, median, count, count_distinct. Exact
names: no aliases.
Supported chart types (v1)¶
bar, line, area.
Every other chart type (pie, donut, scatter, kpi, table,
arc, waterfall, etc.) rejects the support_table: block with a
compile error. Charts with a multi-field y: list are also rejected: the
attached strip needs a single unambiguous x-encoding.
Layered charts are supported. When the legend is hidden, a source: column
that reads a layer's own y measure takes that layer's ink as its header.
Rules¶
source:alone is valid only when the query returns at most one row per x-value. On stacked/grouped charts, useaggregate:to resolve: the renderer errors with a pointer ataggregate:if a baresource:is ambiguous.aggregate:always requiressource:.source:must reference a column present in the chart's query output.- Maximum 40 x-axis ticks (the chart's x-cardinality, not the
number of
support_tablerows). Aggregate or filter in the query before rendering. - Duplicate entries (same
source:+aggregate:combination) reject at compile time. - A strip is a reference like a legend or scale, so on a date axis its columns follow the axis labels. When the axis labels every bucket, the strip has a column per bucket. When it has thinned its labels (weekly buckets under month labels), the strip keeps the first bucket and the buckets the axis labels, whether or not every bucket would fit.
- A support table is a reference, not the full value, so its numbers are
compact even when every digit would fit. A full-digit format prints the
three-digit format of its kind instead:
currency_wholeprintscurrency($279,890becomes$280k) and,dprintsnumber. Three significant digits keep a value under 1,000 as written (206stays206), and a row with a value under 1 prints plain digits (0.4, not400m). A format with an authored prefix, suffix, notation, sign, sign placement, or pad width keeps its digits, and so does any format name the board defines instyle.formats. - A strip never prints cells on top of each other. When its columns do not clear, a date axis drops some of the labeled columns. The first bucket is always kept, so the unit stays declared. A category axis hides the strip instead of dropping buckets. Widen the chart to keep more columns.
- Entries render in list order from the row adjacent to the plot outward:
top-to-bottom for
position: bottom, bottom-to-top forposition: top(the default). The row closest to the plot always corresponds to the first entry in the authored list.
Styling¶
Themeable at three tiers, each merging into the next:
style.charts.support_table.*: universal defaults.style.charts.<chart_type>.support_table.*: per-chart-type override.chart.style.support_table.*: per-chart authored override.
Styleable leaves: font, divider, row, label,
padding_top, padding_bottom, position.
Value digits are always right-aligned, on a left or a right y-axis. There is no alignment knob.
Row labels follow the y-axis side, with one exception: when a line or area
chart's endpoint-label rail makes the axis flip left, the row labels move to
the right, into the rail's column, above the series names. An axis you set to
position: left on a chart without a rail keeps its labels on the left.
position accepts "top" (strip above the plot, default) or
"bottom" (strip below the plot, legacy layout). Override at any
tier to keep below-plot placement:
chart: style: support_table: position: bottom # legacy below-plot layout for this chart
No column-header row exists on support_table. The divider: block
styles a single line drawn between the plot and the strip (off by default;
set visible: true), not a header row.
style: charts: support_table: font: size: 11 divider: visible: true width: 1 label: align: left position: top # default; set bottom for below-plot legacy layout bar: support_table: font: size: 10 # tighter for dense bar charts