j = {
f();
const line = d3
.line()
.x(([x, y]) => x)
.y(([x, y]) => y)
.curve(curve);
const li = d3
.select("#lines")
.on("mousemove", function ({ x, y }) {
let ss = height / (height - (y - 70));
d3.select(this)
.selectAll("path")
.style("stroke-dashoffset", function (d) {
return d3.select(this).node().getTotalLength() / ss;
});
})
.selectAll("path")
.data(data2);
li.enter()
.append("path")
.attr("fill", "none")
.attr("stroke-width", "2")
.attr("stroke", (_, i) => colors[i])
.merge(li)
.attr("d", line)
.style("stroke-dasharray", function (d) {
return d3.select(this).node().getTotalLength();
})
.style("stroke-dashoffset", function (d) {
return 0;
})
.transition()
.ease(d3.easeLinear)
.duration(200)
.style();
}