Plot.plot({
grid: true,
color: { legend: true },
marks: [
Plot.axisY({label: "Monthly count (millions)", tickFormat: (d) => (d / 1_000_000).toLocaleString()}),
Plot.axisX({label: "Date"}),
Plot.ruleY([0]),
Plot.lineY(mapped, {x: "x", y: "y", stroke: "key"}),
Plot.tip(mapped, Plot.pointer({x: "x", y: "y", title: (point) => `${point.x.toLocaleDateString()}\n${point.y.toLocaleString()} ${point.key}`})),
]
})