Public
Edited
Jan 2, 2024
Insert cell
Insert cell
Insert cell
svg`
<svg viewBox="0 0 ${width} ${height}">
<g>
<path fill="none" stroke="black" stroke-width="2" d=${map1.diagram} />
<path fill="none" stroke="black" stroke-width="2" d=${map1.bounds} />
<path fill="black" d=${map1.points} />
</g>
</svg>`
Insert cell
map1 = paths()
Insert cell
paths = () => {
const particles = Array.from({length: n}, () => [Math.random() * width, Math.random() * height])
const delaunay = d3.Delaunay.from(particles)
const voronoi = delaunay.voronoi([2, 2, width - 2, height - 2])
return {particles: particles, diagram: voronoi.render(), bounds: voronoi.renderBounds(), points: delaunay.renderPoints()}
}
Insert cell
Insert cell
Insert cell
Insert cell
width
Insert cell
Insert cell
Insert cell
Insert cell
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