chart = {
const width = 928;
const height = width;
const cx = width * 0.50;
const cy = height * 0.40;
const radius = Math.min(width, height) / 2 - 80;
const tree = d3.tree()
.size([2 * Math.PI, radius])
.separation((a, b) => (a.parent == b.parent ? 1 : 2) / a.depth);
const root = tree(d3.hierarchy(data1)
.sort((a, b) => d3.ascending(a.data.name, b.data.name)));
const svg = d3.create("svg")
.attr("width", width)
.attr("height", height)
.attr("viewBox", [-cx, -cy, width, height])
.attr("style", "width: 100%; height: auto; font: 13px sans-serif;");
svg.append("g")
.attr("fill", "none")
.attr("stroke", "#4e8905")
.attr("stroke-opacity", 0.4)
.attr("stroke-width", 1.0)
.selectAll()
.data(root.links())
.join("path")
.attr("d", d3.linkRadial()
.angle(d => d.x)
.radius(d => d.y));
const linkGroup = svg.append("g")
.attr("fill", "none")
linkGroup
.selectAll()
.data(root.links())
.join("path")
.attr("d", d3.linkRadial()
.angle(d => d.x)
.radius(d => d.y));
const nodeGroup = svg.append("g");
nodeGroup
.selectAll()
.data(root.descendants())
.join("a")
.attr("href", d => d.data.url)
.append("circle")
.attr("transform", d => `rotate(${d.x * 180 / Math.PI - 90}) translate(${d.y},0)`)
.attr("fill", d => d.children ? "#416614" : "#a2db06")
.attr("r", 4);
const labelGroup = svg.append("g")
labelGroup
.selectAll()
.data(root.descendants())
.join("a")
.attr("href", d => d.data.url)
.append("text")
.attr("transform", d => `rotate(${d.x * 180 / Math.PI - 90}) translate(${d.y},0) rotate(${d.x >= Math.PI ? 180 : 0})`)
.attr("dy", "0.31em")
.attr("x", d => d.x < Math.PI === !d.children ? 10 : -10)
.attr("text-anchor", d => d.x < Math.PI === !d.children ? "start" : "end")
.attr("fill", "currentcolor")
.text(d => d.data.name);
return svg.node();
}