Public
Edited
Sep 11, 2024
Insert cell
Insert cell
md`# Setting up D3`
Insert cell
Insert cell
{
const svg = html`<svg viewBox="0 0 ${width} ${height}"></svg>`;

const selSvg = d3.select(svg);

// D3 code goes here
selSvg
.append("circle")
.attr("r", 50)
.attr("fill", "steelblue")
.attr("cx", width / 2)
.attr("cy", height / 2);

return svg;
}
Insert cell
height = width * 0.6
Insert cell
d3 = require("d3-selection@2")
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