Published
Edited
Jul 10, 2021
6 stars
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
wide = FileAttachment("AR6 Graph Data - Sheet1.csv").csv({ typed: true })
Insert cell
cols = Object.keys(wide[0]).slice(2)
Insert cell
flat = wide.flatMap((d) =>
cols.map((c) => ({
about: new Date(Date.UTC(d.year)),
on: new Date(Date.UTC(+c.match(/\d{4}/)[0])),
value: d[c],
series: c
}))
)
Insert cell
actual = wide.map((d) => ({
about: new Date(Date.UTC(d.year)),
on: new Date(Date.UTC(d.year)),
value: d.Observations,
series: "actual"
}))
Insert cell
Inputs.textarea({ value: d3.tsvFormat(flat) })
Insert cell
import { swatches as Swatches } from "@d3/color-legend"
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