Published
Edited
May 10, 2022
Insert cell
Insert cell
data = FileAttachment("data.csv").csv({typed: true})
Insert cell
Insert cell
viewof name = Inputs.select(d3.group(data, d => d.COUNTRY), {label: "Select one", order: "COUNTRY",
})
Insert cell
n = name[1].COUNTRY
Insert cell
Plot.plot({
width: width,
inset: 8,
grid: true,
color: {
//legend: true,
range: ["grey"],
},
x:
{
tickFormat: "y",
domain: [1971,2015],
ticks: 5,
},
marks: [
Plot.line(data,
{
order: "y",
x: "YEAR",
filter: d=>d.YEAR >1970,
y: "VALUE",
stroke: "COUNTRY",
strokeWidth: 0.5,
sort: "YEAR",
curve: "linear",
}),
Plot.dot(data,
{
//order: "value",
x: "YEAR",
filter: d=>d.COUNTRY === n,
y: "VALUE",
fill: "red",
r: 2,
sort: "COUNTRY",
}),
]
})
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