chart = {
const root = pack(data);
const svg = d3.create("svg")
.attr("title", "Packed circle chart")
.attr("viewBox", [0, 0, width, height])
.style("font", "400 16px/1.4 'Source Sans Pro', 'Noto Sans', sans-serif")
.attr("text-anchor", "middle");
const node = svg.selectAll("g")
.data(d3.group(root.descendants(), d => d.height))
.join("g")
.selectAll("g")
.data(d => d[1])
.join("g")
.attr("transform", d => `translate(${d.x + 1},${d.y + 1})`);
node.append("circle")
.attr("r", d => d.r)
.attr("fill", d => color(d.height));
const leaf = node.filter(d => !d.children);
leaf.select("circle")
.attr("id", d => (d.leafUid = DOM.uid("leaf")).id);
leaf.append("clipPath")
.attr("id", d => (d.clipUid = DOM.uid("clip")).id)
.append("use")
.attr("xlink:href", d => d.leafUid.href);
leaf.append("text")
.attr("clip-path", d => d.clipUid)
.selectAll("tspan")
.data(d => d.data.name.split(/(?=[A-Z][a-z])|\s+/g))
.join("tspan")
.attr("x", 0)
.attr("y", (d, i, nodes) => `${i - nodes.length / 2 + 0.8}em`)
.attr("fill", "#40081C")
.text(d => d)
.clone(true)
.lower()
.attr("aria-hidden", "true")
.attr("fill", "none")
.attr("stroke", "#FAEBF0")
.attr("stroke-width", 2)
.attr("stroke-linecap", "round")
.attr("stroke-linejoin", "round");
node.append("title")
.text(d => `${d.ancestors().map(d => d.data.name).reverse().join(" / ")}\nValue: ${d.value}`);
const groupLabel = svg.append("g")
.attr("pointer-events", "none")
.attr("text-anchor", "middle")
.selectAll("text")
.data(root.descendants())
.join("text")
.text(d => d.height === 1 ? d.data.name : '');
groupLabel
.attr("transform", d => `translate(${(d.x)}, ${(d.y - (d.r))})`)
.attr("dy", "-0.25em")
.attr("class", "repo-name")
.attr("fill", "#fff")
.clone(true)
.lower()
.attr("aria-hidden", "true")
.attr("fill", "none")
.attr("stroke", "#6A1131")
.attr("stroke-width", 2)
.attr("stroke-linecap", "round")
.attr("stroke-linejoin", "round");
svg.append("text")
.attr("id", "byline")
.attr("x", width)
.attr("y", height)
.attr("dy", "-1em")
.attr("text-anchor", "end")
.text('@DiDoesDigital');
return svg.node();
}