chart = {
const svg = d3.create("svg")
.attr("viewBox", [0, 0, width, height]);
const g = svg.append("g");
g.selectAll("circle")
.data(data)
.join("rect")
.attr("x", ([x]) => x)
.attr("y", ([, y]) => y)
.attr("width", 50)
.attr("height", 50);
svg.call(d3.zoom()
.extent([[0, 0], [width, height]])
.scaleExtent([1, 8])
.on("zoom", zoomed));
function zoomed({transform}) {
g.attr("transform", transform);
}
return svg.node();
}