Skip to content
Vega-Lite templates

Midnight Bed Occupancy by Ward (Vega-Lite)

A week of midnight occupied beds stacked by ward, showing the Monday and Tuesday peak that drives escalation-area opening.

Template previewVega-Lite
Rendering…

Make it your own.

{
  "$schema": "https://vega.github.io/schema/vega-lite/v5.json",
  "title": "Midnight bed occupancy by ward - week 6",
  "data": {
    "values": [
      {"day": "Mon", "ward": "Acute medical", "beds": 58}, {"day": "Mon", "ward": "Surgical", "beds": 41}, {"day": "Mon", "ward": "Care of the elderly", "beds": 47}, {"day": "Mon", "ward": "Respiratory", "beds": 29},
      {"day": "Tue", "ward": "Acute medical", "beds": 60}, {"day": "Tue", "ward": "Surgical", "beds": 44}, {"day": "Tue", "ward": "Care of the elderly", "beds": 48}, {"day": "Tue", "ward": "Respiratory", "beds": 31},
      {"day": "Wed", "ward": "Acute medical", "beds": 55}, {"day": "Wed", "ward": "Surgical", "beds": 45}, {"day": "Wed", "ward": "Care of the elderly", "beds": 46}, {"day": "Wed", "ward": "Respiratory", "beds": 28},
      {"day": "Thu", "ward": "Acute medical", "beds": 53}, {"day": "Thu", "ward": "Surgical", "beds": 43}, {"day": "Thu", "ward": "Care of the elderly", "beds": 45}, {"day": "Thu", "ward": "Respiratory", "beds": 27},
      {"day": "Fri", "ward": "Acute medical", "beds": 51}, {"day": "Fri", "ward": "Surgical", "beds": 38}, {"day": "Fri", "ward": "Care of the elderly", "beds": 44}, {"day": "Fri", "ward": "Respiratory", "beds": 26},
      {"day": "Sat", "ward": "Acute medical", "beds": 49}, {"day": "Sat", "ward": "Surgical", "beds": 22}, {"day": "Sat", "ward": "Care of the elderly", "beds": 43}, {"day": "Sat", "ward": "Respiratory", "beds": 25},
      {"day": "Sun", "ward": "Acute medical", "beds": 52}, {"day": "Sun", "ward": "Surgical", "beds": 20}, {"day": "Sun", "ward": "Care of the elderly", "beds": 44}, {"day": "Sun", "ward": "Respiratory", "beds": 27}
    ]
  },
  "mark": "area",
  "encoding": {
    "x": {"field": "day", "type": "ordinal", "sort": ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"], "title": null},
    "y": {"field": "beds", "type": "quantitative", "stack": "zero", "title": "Occupied beds at midnight"},
    "color": {"field": "ward", "type": "nominal", "title": "Ward"}
  }
}