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

One platform to build and deploy the best data apps

Experiment and prototype by building visualizations in live JavaScript notebooks. Collaborate with your team and decide which concepts to build out.
Use Observable Framework to build data apps locally. Use data loaders to build in any language or library, including Python, SQL, and R.
Seamlessly deploy to Observable. Test before you ship, use automatic deploy-on-commit, and ensure your projects are always up-to-date.
Learn more