Plot.plot({
width,
height: 400,
marginTop: 40,
label: null,
clip: true,
x: {
domain: [start, end],
},
y: {
grid: true
},
opacity: { type: "identity" },
marks: [
Plot.axisX(d3.utcDay.range(start, end), { interval: d3.utcMonth, anchor: "top", dy: -22, tickSize: 0,
x: (d) => d3.utcHour.offset(d, 12), text: (d) => formatMonth(d)
}),
Plot.axisX(d3.utcDay.range(start, end), { interval: d3.utcDay, anchor: "top",
x: (d) => d3.utcHour.offset(d, 12), text: (d) => formatDay(d3.utcHour.offset(d, 12))
}),
Plot.barX(d3.utcDay.range(start, end), {
interval: d3.utcDay,
fillOpacity: (d) => ((1 + d.getUTCDay()) % 7 < 2 ? 0.15 : 0.05)
}),
Plot.barX([today], {
interval: d3.utcDay,
fill: "yellow",
fillOpacity: 0.5,
clip: true
}),
Plot.barX(vacations, {
x1: "date_start",
x2: "date_end",
y: "name",
fill: "name",
inset: 0.5,
clip: true,
opacity: 0.75
}),
],
tooltip: {
fill: "red",
stroke: "blue",
r: 8
}
})