{
"$schema": "https://vega.github.io/schema/vega/v5.json",
"description": "An area chart example.",
"width": 400,
"height": 200,
"padding": 5,
"data": [
{
"name": "table",
"values": [
{"date": "2024-01-01", "value": 28},
{"date": "2024-02-01", "value": 55},
{"date": "2024-03-01", "value": 43},
{"date": "2024-04-01", "value": 91},
{"date": "2024-05-01", "value": 81},
{"date": "2024-06-01", "value": 53},
{"date": "2024-07-01", "value": 19},
{"date": "2024-08-01", "value": 87}
],
"transform": [
{
"type": "formula",
"expr": "toDate(datum.date)",
"as": "date"
}
]
}
],
"scales": [
{
"name": "xscale",
"type": "time",
"domain": {"data": "table", "field": "date"},
"range": "width"
},
{
"name": "yscale",
"type": "linear",
"domain": {"data": "table", "field": "value"},
"nice": true,
"range": "height"
}
],
"axes": [
{"orient": "bottom", "scale": "xscale", "format": "%b %Y"},
{"orient": "left", "scale": "yscale"}
],
"marks": [
{
"type": "area",
"from": {"data": "table"},
"encode": {
"enter": {
"x": {"scale": "xscale", "field": "date"},
"y": {"scale": "yscale", "field": "value"},
"y2": {"scale": "yscale", "value": 0},
"fill": {"value": "steelblue"},
"fillOpacity": {"value": 0.5}
}
}
}
]
}