beeswarm = {
let el = this
const t = d3.transition().duration(2000)
if (!el) {
el = DOM.svg(width, height)
const svg = d3.select(el)
el.g = svg.append("g")
.attr("transform", `translate(${margin.left}, ${margin.top})`)
el.g.append("g")
.classed("axis axis--x", true)
.attr("transform", `translate(0, ${height - margin.top - margin.bottom})`)
.call(xAxis)
el.g.append("g")
.classed("circles", true)
el.circles = el.g.select("g.circles")
.selectAll("circle")
.data(simulation.nodes(), d => d.id)
el.circles.enter()
.append("circle")
.attr("cx", d => d.x)
.attr("cy", d => d.y)
.attr("r", 3)
.attr("fill", d => color(d.value))
.attr("stroke", "#e2e2e2")
.attr("stroke-width", 0.7)
} else {
el.g.select("g.axis.axis--x")
.transition(t)
.call(xAxis)
const update = d3.select(el)
.selectAll("circle")
.data(simulation.nodes(), d => d.id)
update
.transition(t)
.attr("cx", d => d.x)
.attr("cy", d => d.y)
.attr("fill", d => color(d.value))
el.circles = update
}
return el
}