svg = {
const svg = d3.select(DOM.svg(width, height))
const g = svg.append("g").attr("transform", `translate(${hexRadius},${hexRadius})`)
g.selectAll(".hexagon")
.data(hexbin(points))
.join("path")
.attr("class", "hexagon")
.style("stroke", "white")
.style("stroke-width", 1.5)
.style("fill", (d,i) => color[i])
.attr("d", d => "M" + d.x + "," + d.y + hexbin.hexagon())
.on("mouseover", mover)
.on("mouseout", mout)
function mover(d) {
d3.select(this)
.transition().duration(10)
.style("fill-opacity", 0.3)
}
function mout(d) {
d3.select(this)
.transition().duration(1000)
.style("fill-opacity", 1)
}
return svg.node()
}