Interactive Dashboard with Cross Highlight
A dashboard with cross-highlighting.
View this example in the online editor
Vega-Lite JSON Specification
{
"$schema": "https://vega.github.io/schema/vega-lite/v4.json",
"description": "A dashboard with cross-highlighting.",
"data": {"url": "data/movies.json"},
"vconcat": [
{
"layer": [{
"mark": "rect",
"encoding": {
"x": {
"bin": {"maxbins": 10},
"field": "IMDB Rating"
},
"y": {
"bin": {"maxbins": 10},
"field": "Rotten Tomatoes Rating"
},
"color": {
"aggregate": "count",
"legend": {
"title": "All Movies Count",
"direction": "horizontal",
"gradientLength": 120
}
}
}
}, {
"transform": [{
"filter": {"selection": "pts"}
}],
"mark": "point",
"encoding": {
"x": {
"bin": {"maxbins": 10},
"field": "IMDB Rating"
},
"y": {
"bin": {"maxbins": 10},
"field": "Rotten Tomatoes Rating"
},
"size": {
"aggregate": "count",
"legend": {"title": "Selected Category Count"}
},
"color": {
"value": "#666"
}
}
}]
}, {
"width": 330,
"height": 120,
"mark": "bar",
"selection": {
"pts": {"type": "single", "encodings": ["x"]}
},
"encoding": {
"x": {"field": "Major Genre", "axis": {"labelAngle": -40}},
"y": {"aggregate": "count"},
"color": {
"condition": {
"selection": "pts",
"value": "steelblue"
},
"value": "grey"
}
}
}
],
"resolve": {
"legend": {
"color": "independent",
"size": "independent"
}
}
}