Crossfilter
View this example in the online editor
Vega-Lite JSON Specification
{
"$schema": "https://vega.github.io/schema/vega-lite/v3.json",
"data": {
"url": "data/flights-2k.json",
"format": {"parse": {"date": "date"}}
},
"transform": [{"calculate": "hours(datum.date)", "as": "time"}],
"repeat": {"column": ["distance", "delay", "time"]},
"spec": {
"layer": [{
"selection": {
"brush": {"type": "interval", "encodings": ["x"]}
},
"mark": "bar",
"encoding": {
"x": {
"field": {"repeat": "column"},
"bin": {"maxbins": 20},
"type": "quantitative"
},
"y": {"aggregate": "count", "type": "quantitative"},
"color": {"value": "#ddd"}
}
}, {
"transform": [{"filter": {"selection": "brush"}}],
"mark": "bar",
"encoding": {
"x": {
"field": {"repeat": "column"},
"bin": {"maxbins": 20},
"type": "quantitative"
},
"y": {"aggregate": "count", "type": "quantitative"}
}
}]
}
}