Area Chart with Rectangular Brush
View this example in the online editor
Vega-Lite JSON Specification
{
"$schema": "https://vega.github.io/schema/vega-lite/v3.json",
"data": {"url": "data/unemployment-across-industries.json"},
"encoding": {
"x": {"timeUnit": "yearmonth", "field": "date", "type": "temporal"},
"y": {"aggregate": "sum", "field": "count", "type": "quantitative"}
},
"layer": [{
"selection": {
"brush": {
"type": "interval",
"encodings": ["x"]
}
},
"mark": "area"
}, {
"transform": [
{"filter": {"selection": "brush"}}
],
"mark": {"type": "area", "color": "goldenrod"}
}]
}