Plot.plot({
title: "Daily revenue evolution",
marginLeft: 100,
width: 700,
x: {
tickFormat: Plot.formatWeekday("en"),
tickSize: 0,
domain: [1,2,3,4,5,6,0],
axis: "top"
},
y: {
padding: 0.2,
axis: null,
},
color: {
scheme: "GnBu",
legend: true,
label: "Daily Revenue",
stroke: null
},
fx: {
axis: "top",
},
fy:{
tickFormat: Plot.formatMonth("en"),
padding: 0.2,
},
facet: {
data: dailyRevenue,
x: d => d.order_date.getUTCFullYear(),
y: d => d.order_date.getUTCMonth(),
},
marks: [
Plot.cell(dailyRevenue, {
y: d => d3.timeMonday.count( d3.utcMonth(d.order_date), d.order_date),
x: d => d.order_date.getUTCDay(),
fill: "revenue",
channels: {
Date: {
value: "order_date",
label: "Date"
}
},
tip: {
format: {
Date: true,
r: false,
x: false,
y: false,
fx: false,
fy: false,
}
}
}),
]
})