chart = {
const svg = d3.create("svg")
.attr("viewBox", [0, 0, width, height])
.attr("font-family", "sans-serif")
.attr("font-size", 12);
svg.append("g")
.call(xAxis);
svg.append("g")
.attr("fill", "none")
.attr("stroke", "#000")
.selectAll("path")
.data(d3.groups(data, d => d.name))
.join("path")
.attr("d", ([, group]) => line(group))
.call(path => path.clone(true))
.attr("stroke", "#fff")
.attr("stroke-width", 5);
svg.append("g")
.attr("fill", "#fff")
.selectAll("circle")
.data(data)
.join("circle")
.attr("cx", d => x(d.period))
.attr("cy", d => y(d.value))
.attr("r", 20);
svg.append("g")
.attr("text-anchor", "middle")
.selectAll("text")
.data(data)
.join("text")
.attr("x", d => x(d.period))
.attr("y", d => y(d.value))
.attr("dy", "0.35em")
.text(d => formatValue(d.value));
svg.append("g")
.attr("text-anchor", "end")
.selectAll("text")
.data(d3.groups(data, d => d.name))
.join("text")
.attr("x", margin.left - 12)
.attr("y", ([key, [d]]) => y(d.value) + (key === "Colon") * 10)
.attr("dy", "0.35em")
.attr("dx", "-2em")
.text(([key]) => key);
return svg.node();
}