spec = ({
$schema: "https://vega.github.io/schema/vega-lite/v5.json",
data: { url: "data/seattle-weather.csv" },
transform: [
{ calculate: "datum.temp_max - datum.temp_min", as: "temp_range" }
],
config: {
style: {
area: {
color: "#45010aab"
}
},
view: {
fill: "lightyellow"
}
},
mark: "area",
encoding: {
x: {
timeUnit: "month",
field: "date"
},
y: {
aggregate: "mean",
field: "temp_range"
}
},
params: [
{
name: "brush",
select: { type: "interval", encodings: ["x"] },
value: { month_date: [1331110440000, 1350043886250] },
bind: { element: viewof date }
}
]
})