{
const svg = d3.create("svg")
.attr("viewBox", [0, 0, size, size])
.attr("width", Math.min(width, size))
.style("overflow", "visible");
const arc = svg.selectAll(".arc")
.data(data)
.join("g")
.attr("class", "arc");
arc.append("polyline")
.attr("fill", "none")
.attr("points", d => d)
.attr("stroke", "black");
arc.append("text")
.attr("dy", 4)
.attr("font-family", "sans-serif")
.attr("font-size", 12)
.attr("paint-order", "stroke fill")
.attr("stroke", "white")
.attr("stroke-linejoin", "round")
.attr("stroke-width", 8)
.attr("text-anchor", "middle")
.attr("transform", d => {
const y = (
d.offset < 0 ? d3.min(d, d0 => d0[1]) :
d.offset > 0 ? d3.max(d, d0 => d0[1]) :
size / 2
)
return `translate(${ [ size / 2, y ]})`
})
.text(d => d.offset);
return svg.node();
}