chart = {
let pt_lists = d3.range(10).map(() => {
let cur = 0;
return d3.range(1000).map(function (x) {
let step = 2 * d3.randomInt(0, 2)() - 1;
cur = cur + step;
return [x, cur];
});
});
let plot = Plot.plot({
marks: pt_lists.map((pts) => Plot.line(pts, { strokeWidth: 2 }))
});
d3.select(plot)
.selectAll("path")
.on("pointerenter", function () {
d3.select(plot).selectAll("path").attr("opacity", 0.2);
d3.select(this).attr("opacity", 1);
});
d3.select(plot).on("pointerleave", function () {
d3.select(plot).selectAll("path").attr("opacity", 1);
});
return plot;
}