Bar chart
Bar chart for comparing values across discrete categories.
Use a bar chart to compare a value across discrete categories, such as years, regions or products.
Fieldwork's share of company mentions
This chart cannot be displayed here: it needs JavaScript and WebGL.
The same chart in each style
Source
```chart
type: bar
title: Fieldwork's share of company mentions
data:
inline:
- { year: "2023", share: 3.0 }
- { year: "2024", share: 18.2 }
- { year: "2025", share: 42.8 }
- { year: "2026*", share: 68.2 }
encoding: { x: year, y: share }
axes: { y: { label: Share of mentions (%) } }
```
Fields that matter
type: barwithencoding.xfor the category andencoding.yfor the valueencoding.colorgroups bars by a second categorystack: truestacks the groups ofencoding.colorinstead of placing them side by sidestyle.orientationisauto(default),verticalorhorizontalaxes.y.label,formatandunitdescribe the value axisaxes.y.minandaxes.y.maxfix the ends of the value axis- Each category and series slot takes one observation; repeats are rejected
Values appear automatically when complete text fits inside its own bar, or beside an ordinary bar without crossing ink. Large stacked parts use their raw part value; tiny parts stay unlabelled. The text matches the primary readout at the author’s precision.
Interactions
- Hover or focus a bar to read its value; the bar brightens and other series dim.
- Click a legend entry to toggle a series when the chart has several.
- Open the Table view, Download PNG or CSV, or Expand the chart.