chart = {
const svg = d3.create("svg")
.attr("viewBox", [0, 0, size, size]);
const circle = svg.selectAll("circle")
.data(pack(data).descendants().slice(1))
.join("circle")
.attr("r", d => d.r)
.attr("cx", d => d.x)
.attr("cy", d => d.y);
circle.filter(d => d.data)
.attr("fill", d => color(d.data.radius))
.append("title")
.text(d => `${d.data.name}
Planet radius: ${d.data.radius} EU
Star distance: ${isNaN(d.data.distance) ? "N/A" : `${d.data.distance} pc`}`);
circle.filter(d => d.children)
.attr("fill", "none")
.attr("stroke", "#000")
.attr("stroke-width", 1.5);
return svg.node();
}