Plot.plot({
x: { domain: [new Date("2012-05"), new Date("2022-05")] },
y: {
label: "↑ Job vacancies, seasonally adj. (thousands)",
nice: true,
grid: true
},
marks: [
Plot.areaY(
vacancies,
Plot.map(
{ title: (T) => (T.push(T[T.length - 1]), T.slice(1)) },
{
x: "month",
y: "vacancies",
title: ({ month, vacancies }) =>
`${d3.utcFormat("%b %Y")(month)}: ${vacancies} thousands`,
fill: "pink",
stroke: "pink",
curve: "step-before",
clip: true
}
)
),
Plot.lineY(vacancies, {
x: "month",
y: "vacancies",
curve: "step-before",
clip: true
}),
Plot.ruleY([0])
]
})