chart = {
const root = tree(data);
console.log(root)
const svg = d3.create("svg");
console.log(root.links(),root.descendants())
svg.append("g")
.attr("fill", "none")
.attr("stroke", "#555")
.attr("stroke-opacity", 0.4)
.attr("stroke-width", 1.5)
.selectAll("line")
.data(root.links())
.join("line")
.attr("x1",d=> d.source.x).attr("y1",d=>d.source.y)
.attr("x2",d=>d.target.x).attr("y2", d=>d.target.y-20)
.attr("transform", d => `
rotate(${d.target.x * 180 / Math.PI })`)
svg.append("g")
.selectAll("circle")
.data(root.descendants())
.join("circle")
.attr("transform", d => `
rotate(${d.x * 180 / Math.PI - 90})
translate(${d.y},0)
`)
.attr("fill", d => d.children ? "#555" : "#999")
.attr("r", d=>d.value);
return svg.attr("viewBox", autoBox).node();
}