Public
Edited
Mar 8, 2023
Insert cell
Insert cell
Insert cell
data = FileAttachment("inflation.csv").csv({typed : true})
Insert cell
data
Type Table, then Shift-Enter. Ctrl-space for more options.

Insert cell
Plot.plot({
marks: [Plot.ruleY([0]), Plot.dotY(data, { x: "date", y: "value" })]
})
Insert cell
Plot.plot({
marks: [
Plot.ruleY([0]),
Plot.lineY(
data,
Plot.windowY({ x: "date", y: "value", k: 40, reduce: "mean" })
)
]
})
Insert cell
x = 2
Insert cell
y = x+1
Insert cell
viewof selectedIndex = Inputs.range([0, data.length - 1], { step: 1 })
Insert cell
date = data[selectedIndex].date
Insert cell
function deflate(year) {
return data[data.length - 1].value / data[selectedIndex].value;
}
Insert cell
worth = deflate(selectedIndex)
Insert cell
viewof selectedYear = Inputs.select(data.map((x) => x.date))
Insert cell
selectedIndex2 = data.findIndex((x) => x.date == selectedYear)
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