chart = {
const svg = d3.create("svg").attr("viewBox", [0, 0, width, height]);
const g = svg
.append("g")
.attr("transform", `translate(${margin.left}, ${margin.top})`);
const x = d3.scaleLinear().range([-Math.PI/2,-Math.PI/2+2*Math.PI]);
g.selectAll(".points")
.data(digits)
.join("circle")
.attr("cx", (d, i) => sublocation[i] * iwidth)
.attr("cy", d => (d + Math.random()) * iwidth/10)
.attr("r", 3);
g.selectAll(".circlepoints")
.data(digits)
.join("circle")
.attr("cx", (d, i) => Math.cos(x(d/10 + sublocation[i]/10)) * iwidth/2 + iwidth/2)
.attr("cy", (d, i) => Math.sin(x(d/10 + sublocation[i]/10)) * iheight/2 + iheight/2)
.attr("r", 10);
g.selectAll(".paths")
.data(digits.slice(0, digits.length-1))
.join("path")
.attr("d", (d, i) => circlearc(Math.cos(x(d/10 + sublocation[i]/10)) * iwidth/2 + iwidth/2, Math.sin(x(d/10 + sublocation[i]/10)) * iheight/2 + iheight/2, Math.sin(x(digits[i+1]/10 + sublocation[i+1]/10)) * iheight/2 + iheight/2, Math.sin(x(digits[i+1]/10 + sublocation[i+1]/10)) * iheight/2 + iheight/2))
.attr("stroke", d => "#aaa")
.attr("fill", "none")
return svg.node();
}