chart = {
const center = [width / 2, height / 2];
const svg = d3.create("svg")
.attr("viewBox", [0, 0, width, height]);
const node = svg.append("g")
.selectAll("circle")
.data(data)
.join("circle")
.attr("r", d => d.radius)
.attr("fill", d => d.color);
const simulation = d3.forceSimulation(data)
.on('tick', tick)
.force("collide", d3.forceCollide().radius(d => 1 + d.radius))
.force("x", d3.forceX(center[0]).strength(0.001))
.force("y", d3.forceY(center[1]).strength(0.001))
.stop();
function tick() {
node.attr("cx", d => d.x).attr("cy", d => d.y);
};
tick();
return svg.node();
}