Published
Edited
Jan 19, 2022
1 fork
3 stars
Insert cell
Insert cell
Insert cell
Insert cell
diff[0][0]
Insert cell
Insert cell
vl
.markCircle({
thickness: 4,
bandSize: 2
})
.data(diff[0])
.encode(
vl
.x()
.fieldQ("mins")
.scale({ domain: [-60, 60] }),
vl
.color()
.fieldN("type")
.scale({ range: ["#636363", "#f03b20"] })
)
.config({ bandSize: 10 })
.width(600)
.height(40)
.render()
Insert cell
Insert cell
flat = diff.flatMap((arr, i) => arr.map((d) => ({ ...d, array: i })))
Insert cell
Insert cell
vl
.markCircle({
thickness: 4,
bandSize: 2
})
.data(flat)
.encode(
vl.row().fieldN("array"),
vl
.x()
.fieldQ("mins")
.scale({ domain: [-60, 60] }),
vl
.color()
.fieldN("type")
.scale({ range: ["#636363", "#f03b20"] })
)
.config({ bandSize: 10 })
.width(600)
.height(40)
.render()
Insert cell
Insert cell
htl.html`${await Promise.all(
diff.map(
async (data, i) =>
htl.html`<p>Hello, here is chart ${i}</p>${await vl
.markCircle({
thickness: 4,
bandSize: 2
})
.data(data)
.encode(
vl
.x()
.fieldQ("mins")
.scale({ domain: [-60, 60] }),
vl
.color()
.fieldN("type")
.scale({ range: ["#636363", "#f03b20"] })
)
.config({ bandSize: 10 })
.width(600)
.height(40)
.render()}`
)
)}`
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