Plot.plot({
width: 960,
inset: 6,
x: {
domain: d3.utcDays(...d3.extent(aapl, (d) => d.Date))
.filter((d) => d.getUTCDay() > 0 && d.getUTCDay() < 6),
ticks: d3.utcMondays(...d3.extent(aapl, (d) => d.Date)),
tickFormat: "%-m/%-d",
label: null
},
y: { label: "↑ Apple stock price ($)", grid: true },
color,
marks: [
Plot.ruleX(aapl, { x: "Date", y1: "Low", y2: "High" }),
Plot.ruleX(aapl, {
x: "Date",
y1: "Open",
y2: "Close",
stroke: (d) => Math.sign(d.Close - d.Open),
strokeWidth: 4,
strokeLinecap: "round"
})
]
})