Plot.plot({
marks: [
Plot.rectY(data, { x1: "date", x2: d => d3.utcDay.offset(d.date), y: "kwh", title: tip, inset: 1, fill: weekendColor }),
Plot.link(data, Plot.binX({y1: "mean", y2: "mean" }, { x: "date", y: "kwh", stroke: "blue", thresholds: d3.timeMonth })),
Plot.line(data, Plot.windowY({ x: "date", y: "kwh", k: 7, stroke: "orange", curve: "step" }))
],
y: { grid: true },
x: {
tickRotate: 90,
tickFormat: d => timeFormat(d),
},
color: { ...weekendColorOptions },
marginLeft: 30,
marginBottom: 100,
width: width,
style: {
fontSize: "9px"
}
})