Published
Edited
Nov 17, 2021
Insert cell
Insert cell
Insert cell
aapl = (await FileAttachment("aapl.csv").csv({typed: true})).slice(-40)
Insert cell
Plot.plot({
marginBottom: 80,
x: {
tickRotate: -90,
label: null
},
y: {
grid: true,
transform: d => d / 1e6,
label: "↑ Daily trade volume (millions)"
},
marks: [
Plot.barY(aapl, {x: "Date", y: "Volume"}),
Plot.ruleY([0])
]
})
Insert cell
Insert cell
Plot.plot({
y: {
grid: true,
transform: d => d / 1e6,
label: "↑ Daily trade volume (millions)"
},
marks: [
Plot.rectY(aapl, {x: "Date", interval: d3.utcDay, y: "Volume"}),
Plot.ruleY([0])
]
})
Insert cell
Insert cell
customInterval = d3.utcDay.filter(d => d.getUTCDay() !== 0 && d.getUTCDay() !== 6)
Insert cell
value = new Date
Insert cell
interval = [
customInterval.floor(value), // start
customInterval.offset(customInterval.floor(value)) // stop
]
Insert cell
Plot.plot({
y: {
grid: true,
transform: d => d / 1e6,
label: "↑ Daily trade volume (millions)"
},
marks: [
Plot.rectY(aapl, {x: "Date", interval: customInterval, y: "Volume"}),
Plot.ruleY([0])
]
})
Insert cell
Insert cell
Plot.plot({
marginBottom: 80,
x: {
tickRotate: -90,
label: null
},
y: {
grid: true,
transform: d => d / 1e6,
label: "↑ Daily trade volume (millions)"
},
marks: [
Plot.barY(aapl, {x: "Date", y: "Volume", interval: 1e7}),
Plot.ruleY([0])
]
})
Insert cell
Insert cell
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more