Skip to content

Instantly share code, notes, and snippets.

@jonmmease
Created September 20, 2022 12:23
Show Gist options
  • Save jonmmease/dbb06e3665573fddc6bb59e12b793722 to your computer and use it in GitHub Desktop.
Save jonmmease/dbb06e3665573fddc6bb59e12b793722 to your computer and use it in GitHub Desktop.
crossfilter_with_output_dataset
{
"$schema": "https://vega.github.io/schema/vega-lite/v5.json",
"title": "Seattle Weather, 2012-2015",
"data": {"url": "data/seattle-weather.csv"},
"vconcat": [
{
"layer": [
{
"mark": {"type": "rect", "width": 1, "height": 1},
"encoding": {"opacity": {"value": 0}},
"transform": [
{"filter": {"param": "click"}},
{"filter": {"param": "brush"}}
]
},
{
"encoding": {
"color": {
"condition": {
"param": "brush",
"title": "Weather",
"field": "weather",
"type": "nominal",
"scale": {
"domain": ["sun", "fog", "drizzle", "rain", "snow"],
"range": [
"#e7ba52",
"#a7a7a7",
"#aec7e8",
"#1f77b4",
"#9467bd"
]
}
},
"value": "lightgray"
},
"size": {
"title": "Precipitation",
"field": "precipitation",
"scale": {"domain": [-1, 50]},
"type": "quantitative"
},
"x": {
"field": "date",
"timeUnit": "monthdate",
"title": "Date",
"axis": {"format": "%b"}
},
"y": {
"title": "Maximum Daily Temperature (C)",
"field": "temp_max",
"scale": {"domain": [-5, 40]},
"type": "quantitative"
}
},
"width": 600,
"height": 300,
"mark": "point",
"params": [
{
"name": "brush",
"select": {"type": "interval", "encodings": ["x"]}
}
],
"transform": [{"filter": {"param": "click"}}]
}
]
},
{
"encoding": {
"color": {
"condition": {
"param": "click",
"field": "weather",
"scale": {
"domain": ["sun", "fog", "drizzle", "rain", "snow"],
"range": ["#e7ba52", "#a7a7a7", "#aec7e8", "#1f77b4", "#9467bd"]
}
},
"value": "lightgray"
},
"x": {"aggregate": "count"},
"y": {"title": "Weather", "field": "weather"}
},
"width": 600,
"mark": "bar",
"params": [
{"name": "click", "select": {"type": "point", "encodings": ["color"]}}
],
"transform": [{"filter": {"param": "brush"}}]
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment