Published
Edited
Apr 28, 2021
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
weather_
Insert cell
{
const tempMinMax = vl.markArea({opacity: 0.3})
.data(weather_)
.encode(
vl.x().month('date'),
vl.y().average('temp_max'),
vl.y2().average('temp_min'),
vl.color().fieldN('nyc').legend(null)
);

const tempMid = vl.markLine()
.data(weather_)
.transform(
vl.calculate('(datum.temp_min + datum.temp_max) / 2').as('temp_mid')
)
.encode(
vl.x().month('date'),
vl.y().average('temp_mid'),
vl.color().fieldN('location')
);

return vl.layer(tempMinMax, tempMid)
.resolve({"scale": {"color": "independent"}}).render();
}
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more