twindragonChart = {
const svg = d3.create("svg")
.attr("viewBox", [0, 0, w, h]);
const g = svg.append("g")
.attr("cursor", "grab");
g.selectAll("circle")
.data(data)
.join("circle")
.attr("cx", (d) => parseFloat(d.x) + 0.55*w)
.attr("cy", (d) => -parseFloat(d.y) + 0.375*h)
.attr("r", radius)
.attr("fill", (d, i) => colors(parseInt(d.dark)));
svg.call(d3.zoom()
.extent([[0, 0], [h, h]])
.scaleExtent([1, 22])
.on("zoom", zoomed));
svg.call(d3.drag()
.on("start", dragstarted)
.on("drag", dragged)
.on("end", dragended));
function dragstarted() {
d3.select(this).raise();
g.attr("cursor", "grabbing");
}
function dragged(event, d) {
d3.select(this).attr("cx", d.x = event.x).attr("cy", d.y = event.y);
}
function dragended() {
g.attr("cursor", "grab");
}
function zoomed({transform}) {
g.attr("transform", transform);
}
return svg.node();
}