Plot.plot({
marginLeft: 60,
y: {
grid:true,
nice: true,
label: "visits"
},
x: {
tickFormat: Plot.formatMonth("en", "short"),
nice: true
},
opacity: {
domain: [d3.min(stats, d=>d.year), d3.max(stats, d=>d.year)],
range: [0,1]
},
marks: [
Plot.line(stats, Plot.groupX(
{ y: 'sum' },
{
x: 'month',
z: 'year',
y: 'visits',
opacity:'year',
title: 'year'
})),
Plot.text(stats, {
x: 'month',
y: 'visits',
text: 'year'
})
]
})