{
const [svgNode, svg] = getSVG(width, height, margin, true);
const circleGroup = svg
.append("g")
.style('fill', "steelblue")
.style('opacity', 0.5)
.style('stroke', "black");
const drawCircles = () => {
const t = circleGroup.transition().duration(750);
circleGroup
.selectAll("circle")
.data(getRandomizedData(), d => d.id)
.join(
enter =>
enter
.append("circle")
.attr("r", rad)
.attr("cx", d => d.x)
.attr("cy", d => d.y)
.style("fill", "black"),
update => {
update.call(selection =>
selection
.transition(t)
.attr("cx", d => d.x)
.attr("cy", d => d.y)
.style("fill", d => colorScale(d.id))
);
},
exit =>
exit.style("fill", "none").call(selection =>
selection
.transition(t)
.attr("cy", height)
.remove()
)
);
};
drawCircles(getRandomizedData());
d3.select("#update_3").on("click", drawCircles);
return svgNode;
}