chart = {
const svg = d3.select(DOM.svg(width, height))
.style("-webkit-tap-highlight-color", "transparent")
.style("overflow", "visible");
svg.append("g")
.call(xAxis);
svg.append("g")
.call(yAxis);
svg.append("path")
.datum(data)
.attr("fill", "none")
.attr("stroke", "steelblue")
.attr("stroke-width", 1.5)
.attr("stroke-linejoin", "round")
.attr("stroke-linecap", "round")
.attr("d", line);
const dots = svg
.selectAll("circle")
.data(data)
.enter()
.append("circle")
.style("fill", "steelblue")
.attr("class", "dot")
.attr("r", 3)
.attr("cx", function(d) {
return x(d.d);
})
.attr("cy", function(d) {
return y(d.v);
});
const tooltip = svg.append("g");
svg.on("touchmove mousemove", function(event) {
const {d, v} = bisect(d3.pointer(event, this)[0]);
tooltip
.attr("transform", `translate(${x(d)},${y(v)})`)
.call(callout, `${v}
${formatDate(d)}`);
});
svg.on("touchend mouseleave", () => tooltip.call(callout, null));
return svg.node();
}