Plot.plot({
height: 250,
y: { inset: 20 },
color: { domain: [true, false], range: ["lightblue", "#FFD580"] },
marks: [
Plot.rectX(
data,
Plot.binX(
{
x1: "min",
x2: "max",
fill: (w) => data[w[0] - 1]?.Close < data[w.at(-1)].Close
},
{
x: "Date",
interval: "week",
x1: "Date",
x2: "Date",
fill: (_, i) => i
}
)
),
Plot.lineY(data, {
x: "Date",
y: "Close",
z: (d) => d3.utcWeek(d.Date),
marker: true
})
]
})