Plot.plot({
height: 1400,
x: {
axis: null,
padding: 0,
},
y: {
padding: 0,
tickFormat: Plot.formatWeekday("en", "narrow"),
tickSize: 0
},
fy: {
reverse: true
},
facet: {
data: DJI,
y: d => d.Date.getUTCFullYear()
},
color: {
type: "diverging",
scheme: "PiYG"
},
marks: [
Plot.cell(DJI, {
x: d => d3.utcWeek.count(d3.utcYear(d.Date), d.Date),
y: d => d.Date.getUTCDay(),
fill: (d, i) => i > 0 ? (d.Close - DJI[i - 1].Close) / DJI[i - 1].Close : NaN,
title: (d, i) => i > 0 ? ((d.Close - DJI[i - 1].Close) / DJI[i - 1].Close * 100).toFixed(1) : NaN,
inset: 0.5
})
]
})