Published
Edited
Oct 24, 2019
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
plot = ({
width:600,
mark:{
type:"line",
interpolate:"monotone"
},
data:{
values:weather
},
transform:[
{calculate:`(datum.main.temp-273.15)*9/5+32`,as:"y"},
{calculate:`date(datum.local)`,as:"date"}
],
encoding:{
x:{field:"local",type:"temporal"},
y:{field:"y",type:"quantitative"},
color:{field:"date",type:"nominal"}
}
})
Insert cell
Insert cell
weather = {
var response = await d3.json("https://gist.githubusercontent.com/bendazz/f02f410b945ae44b5db51dd9b49e02b4/raw/2d112ec26fd4a52ea7e6b6cf83a97864859af945/gistfile1.txt")
response.list.forEach(d => {
d.local = moment.utc(d.dt_txt)._d
})
return response.list
}
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
moment = require('moment')
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