Bar
Vertical and horizontal bar charts with stacking, dodging, and optional value labels.
The workhorse mark. Use bars when comparing values across categories.
barY
Vertical bars – categories on x, values on y:
barX
Horizontal bars – flip the axes. Good for long category labels:
Stacking
When fill maps to a field, bars stack by default. Each color segment shows its contribution to the total:
Dodging
Set group: "dodge" to place bars side-by-side. Better for comparing individual series values:
With value labels
Layer a text mark on top to add labels. Use shared top-level data so both marks read the same dataset:
Properties
| Field | Type | Default | Description |
|---|---|---|---|
group | "stack" | "dodge" | "stack" | How to group bars when a color field is present. |
cornerRadius | number | theme | Corner radius on the value end of the bar (defaults to the theme's barCornerRadius). |
label | true | { show?: ("value" | "percent" | "category" | "total")[]; position?: "auto" | "outside" | "inside"; format?: string } | – | Label bars with any of value, percent, category, or stack total – combine them (e.g. ["category","value"]) for a composite. true shows the value. |