chart = {
const svg = d3.create("svg")
.attr("width", width)
.attr("height", height);
let circles = update(svg, nodes)
let simulation = d3.forceSimulation()
.nodes(nodes)
.force('charge', d3.forceManyBody().strength(defaults.FORCEMANYBODY_STRENGTH))
.force('collision', d3.forceCollide().radius(defaults.COLLISION_RADIUS).strength(defaults.COLLISION_STRENGTH))
.force('center', d3.forceCenter(width/2, height/2).strength(1))
.force('x', d3.forceX(width/2).strength(defaults.XFORCE_STRENGTH))
.force('y', d3.forceY(height/2).strength(defaults.YFORCE_STRENGTH))
simulation.on('tick', ticked)
simulation.velocityDecay(defaults.VELOCITY_DECAY).alpha(defaults.ALPHA).restart()
function ticked() {
circles
.attr('cx', (d) => d.x)
.attr('cy', (d) => d.y)
}
return svg.node();
}