data[0].date// Formatted as "%b %y" (short month name, short year)
values=data.map((d)=>({
date:d3.utcParse("%b %y")(d.date),
value:+d.value
}))
Plot.rectY(values,{
x:"date",
y:"value",
interval:"month"// transforms a date "point" into an interval
}).plot({
marginLeft:50
})
Plot.barY(data,{
x:"date",
y:"value"
}).plot({
width,
marginLeft:50,
marginBottom:60,
x:{
transform:d3.utcParse("%b %y"),
tickRotate:-60,
tickFormat:"%b %y",
interval:"month"
}
})
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.