Public
Edited
Mar 12, 2023
Insert cell
Insert cell
data = FileAttachment("values.csv").csv({ typed: true })
Insert cell
data[0].date // Formatted as "%b %y" (short month name, short year)
Insert cell
Insert cell
values = data.map((d) => ({
date: d3.utcParse("%b %y")(d.date),
value: +d.value
}))
Insert cell
Plot.rectY(values, {
x: "date",
y: "value",
interval: "month" // transforms a date "point" into an interval
}).plot({
marginLeft: 50
})
Insert cell
Insert cell
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"
}
})
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