Plot.plot({
title: "What is the category of pizza with the most revenue in 2021?",
subtitle: "Accumulative revenue for each category along the the year",
marginLeft: 70,
marginRight: 70,
grid: true,
x: {
line: true,
domain: months
},
marks: [
Plot.ruleY([0]),
Plot.lineY(category_revenue_data, {x: "month", y: "acc_revenue", stroke: "category"}),
Plot.lineY(average_revenue, {x: "month", y: "avg_revenue"}),
Plot.dot(category_revenue_data, { x: "month", y: "acc_revenue", fill: "category", size: 5 }),
Plot.text(category_revenue_data, Plot.selectLast({x: "month", y: "acc_revenue", z: "category", text: "category", textAnchor: "start", dx: 3})),
Plot.text([{ month: average_revenue[average_revenue.length - 1].month, avg_revenue: average_revenue[average_revenue.length - 1].avg_revenue}], { x: "month", y: "avg_revenue", text: d => "Average", textAnchor: "start", dx: 3})
]
})