Public
Edited
Sep 30, 2024
Fork of Arc Corners
Insert cell
Insert cell
Insert cell
chart = {
const data = [1, 1, 2, 3, 5, 8, 13, 21];
const pie = d3.pie().padAngle(0.03);
const arc = d3.arc().innerRadius(innerRadius).outerRadius(outerRadius);

const svg = d3.create("svg")
.attr("viewBox", [-width / 2, -height / 2, width, height]);
svg.append("g")
.attr("fill", "none")
.attr("stroke", "#777")
.selectAll("path")
.data(pie(data))
.join("path")
.attr("d", arc.cornerRadius(0));

svg.append("g")
.attr("fill", "#ccc")
.attr("stroke", "#000")
.attr("stroke-width", "1.5px")
.attr("stroke-linejoin", "round")
.selectAll("path")
.data(pie(data))
.join("path")
.attr("d", arc.cornerRadius(cornerRadius));

return svg.node();
}
Insert cell
width = 960
Insert cell
height = 500
Insert cell
outerRadius = height / 2 - 30
Insert cell
innerRadius = outerRadius / 3
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