Public
Edited
Jun 14, 2023
Fork of Donut Chart
Insert cell
Insert cell
Insert cell
Insert cell
color = d3
.scaleOrdinal()
.domain(data.map(d => d.name))
.range(['rgb(0,255,180)', '#aaa'])
Insert cell
height = Math.min(width, 500)
Insert cell
arc = {
const radius = Math.min(width, height) / 2;
return d3.arc().innerRadius(radius * 0.67).outerRadius(radius - 1);
}
Insert cell
pie = d3.pie()
.padAngle(0.005)
.sort(null)
.value(d => d.value)
Insert cell
d3 = require("d3@6")
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