Skip to content
Vega-Lite templates

Math — Chart: Grouped Bar (Two Series)

Comparing two data series across categories.

Template previewVega-Lite
Rendering…

Make it your own.

{
  "$schema": "https://vega.github.io/schema/vega-lite/v5.json",
  "description": "Two-series grouped bar chart",
  "data": {"values": [
    {"category": "A", "group": "2023", "value": 28},
    {"category": "A", "group": "2024", "value": 35},
    {"category": "B", "group": "2023", "value": 55},
    {"category": "B", "group": "2024", "value": 49},
    {"category": "C", "group": "2023", "value": 43},
    {"category": "C", "group": "2024", "value": 61}
  ]},
  "mark": "bar",
  "encoding": {
    "x": {"field": "category", "type": "nominal", "title": "Category"},
    "xOffset": {"field": "group"},
    "y": {"field": "value", "type": "quantitative", "title": "Value"},
    "color": {"field": "group", "type": "nominal", "title": "Year"}
  }
}