Published
Edited
Apr 29, 2021
1 fork
5 stars
Insert cell
Insert cell
test = html`<svg>
<path d="M0,0 L10,10"
</svg>`
Insert cell
path = test.querySelector("path")
Insert cell
pathLength = path.getTotalLength()
Insert cell
numSamples = 10
Insert cell
step = Math.ceil(pathLength / numSamples)
Insert cell
points = {
let points = [];
for (let i = 0; i < numSamples; i++) {
let point = path.getPointAtLength(i * step);
points.push({ x: point.x, y: point.y });
}
return points;
}
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