chart3 = {
let svg = getSvg();
svg.update = function (shift) {
let g = svg
.selectAll("g")
.data(data)
.join(
(enter) => {
let g = enter.append("g");
g.append("circle")
.attr("cx", (d) => d * 40 + 100 + shift)
.attr("cy", 50)
.attr("fill", "steelBlue")
.attr("opacity", 0.5)
.attr("r", 30);
g.append("text")
.attr("x", (d) => d * 40 + 100 + shift)
.attr("y", 50)
.style("text-anchor", "middle")
.style("dominant-baseline", "middle")
.attr("fill", "black")
.text((d) => d);
},
(update) => {
update
.select("circle")
.attr("cx", (d) => d * 40 + 100 + shift)
.attr("cy", 50)
.attr("fill", "steelBlue")
.attr("opacity", 0.5)
.attr("r", 30);
update
.select("text")
.attr("x", (d) => d * 40 + 100 + shift)
.attr("y", 50)
.style("text-anchor", "middle")
.style("dominant-baseline", "middle")
.attr("fill", "black")
.text((d) => d);
},
(exit) => exit.remove()
);
};
return svg;
}