chart = {
const svg = d3.create("svg")
.attr("viewBox", [0, 0, width, height]);
let g = svg.append("g")
.attr("stroke", "#000")
.attr("stroke-opacity", 0.4)
.selectAll("path")
.data(coordinates)
.join("g")
g.append("path")
.attr("d", hg.hexagon)
.attr("transform", d => `translate(${hg.midx(d.x, d.y)},${hg.midy(d.x, d.y)})`)
.attr("fill", "#37c733")
.attr("fill-opacity", 0.5)
g.append("text")
.text(d => d.x + "," + d.y)
.attr("font-size", 7)
.attr("text-anchor", "middle")
.attr("alignment-baseline", "middle")
.attr("transform", d => `translate(${hg.midx(d.x, d.y)},${hg.midy(d.x, d.y)})`)
return svg.node();
}