$ RENDER_CHART --type=bar --source=categories.json
SPEC_BREAKDOWN
What this chart teaches
- mark: "bar"
- The simplest mark. Vega-Lite infers a grouped bar chart from the nominal x + quantitative y combo.
- encoding.x - nominal
- Field type
nominalmeans discrete, unordered categories. Vega-Lite draws one bar per unique value. - sort: "-y"
- Sorts bars by the y-axis field in descending order. Makes the tallest bar appear first, improving readability.
- color.scale.range
- Custom palette array. Each category gets a colour from the array in order.
legend: nullhides the default legend since the x-axis already labels the bars. - mark.cornerRadiusEnd
- Rounds the top corners of each bar - a cosmetic property on the mark object.