chart = {
const svg = d3.create("svg").attr("viewBox", [0, 0, width, height]);
svg.append("g").call(xAxis);
svg.append("g").call(yAxis);
const g = svg
.append("g")
.attr("fill", "none")
.attr("stroke-linejoin", "round")
.attr("stroke-linecap", "round");
g.selectAll("path")
.data(dataGrouped)
.join("path")
.attr("stroke", "gray")
.attr("stroke-width", .5)
.attr("d", line)
.call(halo);
g.append("path")
.datum(dataActual)
.attr("stroke", "steelblue")
.attr("stroke-width", 1.5)
.attr("d", line);
g.selectAll("text")
.data(dataGrouped.map(d => d[d.length - 1]))
.join("text")
.attr("fill", "gray")
.attr("font-size", 10)
.attr("font-family", "sans-serif")
.attr("dx", 4)
.attr("dy", ".3em")
.attr("x", ({ about }) => x(about))
.attr("y", ({ value }) => y(value))
.text(({ on }) => dateFormat(on));
return svg.node();
}