bar
Rectangles standing on one axis at the names of the other: bar(x: North, South; y: 42, 31) rules the x axis in those names and stands a bar at each. A series mark like scatter — x and y are read the same way and paired by position — and it is the categorical axis (x-format/y-format, or the auto rule) that makes it a bar chart. Exactly one axis must be categorical; the other is the value axis, which always reaches the baseline. Which axis is which is the orientation. Several bars at one name split the band in source order; stack stands a bar on the one before it. Not a histogram: a histogram’s width is data (its bins are edges), a bar’s is a share of a band.
#Attributes
The readings’ x values: names, numbers, or a dataset column (
#sales.region). Paired with y by position; a pair either axis cannot read is dropped whole.Can be written as shorthand: bar:valueAlso written: atLong-format data: one row per name per period, this naming the period column (
period: #sales.year). The bars then show the slice at whatever the environment's parameter.time holds, gliding between the two periods that bracket it. Periods may be years, ISO dates, month or weekday names, HH:MM hours or YYYY-Www weeks.Also written: colors, colour, colorColour for each bar, cycled in order — one colour colours the lot. If fewer colours than bars are given, the list starts again from the first.
Default
The share of the band at each name that the bars fill, 0–1. Several bars at one name divide it between them.
Default
Also written: stackedStand on top of the bar written before this one, in its share of the band, instead of beside it.
Default
Text drawn beside the element — rich text, so
$maths$ and inline formatting render. Fades and draws with the element.Declared but not drawn. Animatable —
hidden: true !cue.to{false}(at: 2) reveals it — and unlike a cue, a hidden element still frames the plot, so the axes do not jump when it appears.Default
Also written: lockedKeeps the reader from editing this element on an
editable: graph. Nothing at all on a graph that is not editable.Default