chart = {
const marginLeft = 100;
const maxCircleRadius = 40;
const height = 200;
const svg = d3.create("svg").attr("width", width).attr("height", height);
const circles = svg
.selectAll("g")
.data(subset)
.join("g")
.classed("item", true);
circles
.append("circle")
.attr("cx", (d, i) => i * 100 + maxCircleRadius + 5)
.attr("cy", height / 2)
.attr("r", maxCircleRadius)
.attr("fill", "white")
.attr("stroke", "red")
.attr("stroke-width", "2");
circles
.append("text")
.attr("x", (d, i) => i * 100 + maxCircleRadius + 5)
.attr("y", height / 2)
.attr("dy", ".4em")
.style("text-anchor", "middle")
.style("font-family", "Prompt")
.text((d) => d);
circles.on("mouseover", function (e, d) {
d3.select(this).attr("opacity", 0.5);
});
circles.on("mouseout", function (e, d) {
d3.select(this).attr("opacity", 1);
});
return svg.node();
}