VereinsgroessenProVerbandChart = {
const width = 928;
const height = width;
const margin = 1;
const format = d3.format(",d");
const value = (d) => d?.type === "l" ? 40 : d?.type ==="m" ? 10 : 5;
const root = d3.stratify().path((d,n) => d.name+"/"+d.id)(vereineBySize2022);
root.sum(d => Math.max(0, value(d))).sort((a, b) => {
return b.value - a.value
});
const pack = d3.pack()
.size([width - margin*2, height - margin*2])
.padding(2)
(root);
const svg = d3.create("svg")
.attr("width", width)
.attr("height", height)
.attr("viewBox", [-margin, -margin, width, height])
.attr("style", "width: 100%; height: auto; font: 10px sans-serif;")
.attr("text-anchor", "middle");
const node = svg.append("g")
.selectAll()
.data(root.descendants().filter(d => !d.children))
.join("g")
.attr("transform", d => `translate(${d.x},${d.y})`);
node.append("circle")
.attr("fill", "green")
.attr("r", d => d.r);
const enclosings = svg.append("g")
.selectAll()
.data(root.descendants().filter(d => d.children && d.parent))
.join("g")
.attr("transform", d => `translate(${d.x},${d.y})`);
const text = enclosings
.append("text")
.attr("style", "font-weight:bold")
.text(d => d.id.slice(1));
return svg.node();
}