{
const lorries = (await FileAttachment("lorries.csv").csv()).map(d => ({
...d,
Date: new Date(d.Date),
Value: +d.Value
}))
const plot = Plot.plot({
height: 360,
width: 580,
y: {
domain: [0,120],
grid: true,
tickSize: 0,
label: "Thousands"
},
color: {
domain: ["Under 35", "36-45", "46-55", "56-65", "66+"],
range: ["#206095", "#27A0CC", "#003C57", "#118C7B", "#A8BD3A"]
},
marks: [
Plot.line(lorries, {x: "Date", y: "Value", z: "Age", stroke: "Age", strokeWidth: 3}),
Plot.dot(lorries, {x: "Date", y: "Value", z: "Age", fill: "Age"}),
Plot.text(lorries, Plot.selectLast({x: "Date", y: "Value", z: "Age", text: "Age", textAnchor: "start", dx: 5, dy: 3, fill: "Age", fontSize: 14}))
],
style: {fontSize: "12px", fontFamily: "'Open Sans', sans-serif", overflow: "visible"}
})
return plot
}