bar
Use for category × number comparisons where row order matters (months, regions, ranked lists). One mark per category; optional series for grouped bars.
Do not use for continuous x (prefer line / scatter), part-to-whole slices (pie), or raw distribution bins (hist).
Optional layout: grouped | stacked | percent. Omit or grouped keeps side-by-side bars. Optional orient: horizontal for long category labels. An empty y is a missing mark, not a zero. Stacked and percent require every cell.
x category · y number · series optional; layout controls grouping
Rules. Keep input row order. Never sort x. layout: grouped (default) | stacked | percent. orient: horizontal puts categories on the side. A repeated category/series key → E_DUP_KEY. An empty y is a missing mark, not a zero, except stacked and percent, which require every cell (E_MISSING_VALUE). Text that is not a number → E_BAD_NUMBER.
Example
chart
markvis: 2
type: bar
layout: stacked
title: Tickets by month
x: month
y: tickets
series: team
month,team,tickets
Jan,alpha,80
Jan,beta,40
Feb,alpha,100
Feb,beta,80| month | team | tickets |
|---|---|---|
| Jan | alpha | 80 |
| Jan | beta | 40 |
| Feb | alpha | 100 |
| Feb | beta | 80 |
When the block is wrong
The rows stay, with one line that names the error.
chart
markvis: 2
type: bar
innerRadius: 0.4
title: Wrong-type extra field
x: month
y: tickets
month,tickets
Jan,120
Feb,180| month | tickets |
|---|---|
| Jan | 120 |
| Feb | 180 |
E_UNKNOWN_FIELD: undeclared fence field: innerRadius
Generated from packages/types/bar/ and the type's row in SPEC.md.