Public
Edited
Sep 28, 2023
Insert cell
Insert cell
locationsToShow = ["KOR", "ISR", "EU27_2020", "USA"]
Insert cell
data = {
const data = await FileAttachment("DP_LIVE_28092023132356978.csv").csv({
typed: true
});

return data
.filter((d) => locationsToShow.includes(d["LOCATION"]))
.filter((d) => d["MEASURE"] === "PC_GDP")
.map((d) => {
const time = d["TIME"];
const value = d["Value"];
const location = d["LOCATION"];

return { date: new Date(time, 0, 1), time, value, location };
})
.sort((a, b) => b.time - a.time);
}
Insert cell
Plot.plot({
color: { legend: true },
y: { grid: true, domain: [0, 6] },
x: { domain: [1990, 2025] },
marks: [
Plot.ruleY([0]),
Plot.line(
data.filter((d) => d.time > 1990),
{
x: "time",
y: "value",
z: "location",
stroke: "location",
tip: true
}
),
Plot.text(
data.filter((d) => d.time === 2021),
{
x: "time",
y: "value",
z: "location",
text: "location",
textAnchor: "start",
dx: 4
}
)
]
})
Insert cell
Could we pull out Korea, Israel, EU and the US from this data

KOR ISR EU27_2020 USA
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