Published
Edited
Apr 11, 2022
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Plot.plot({
x: {
//type: "band",
tickFormat: d3.timeFormat("%d.%m")
},
y: {
grid: true,
tickFormat: d3.timeFormat("%I %p")
//domain: [new Date("1970-02-01T00:00:00Z"), new Date("1970-02-02T00:00:00Z")]
},
marks: [
Plot.rect(sessions, {
x1: (e) => d3.utcDay(e.start),
x2: (e) => d3.utcDay(e.end.setDate(e.end.getDate() + 1)),
y1: (e) => +d3.utcFormat("%H%M")(e.start),
y2: (e) => +d3.utcFormat("%H%M")(e.end),
fillOpacity: 0.8,
fill: "black"
}),
Plot.ruleY([0])
]
})
Insert cell
Insert cell
function unifyDates(t) {
t = new Date(t);
t.setDate(1);
t.setMonth(1);
t.setYear(1970);
return t;
}
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