Public
Edited
Nov 18, 2022
2 stars
Insert cell
Insert cell
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;
}
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more