Published
Edited
Aug 2, 2019
2 forks
9 stars
Insert cell
Insert cell
Insert cell
Insert cell
segments = PathData.parse(path, {normalize: true})
Insert cell
lines = {
const type = {M: "moveTo", L: "lineTo", C: "bezierCurveTo", Z: "closePath"};
return [
`context.beginPath();`,
...segments.map(s => `context.${type[s.type]}(${s.values.join(", ")});`)
];
}
Insert cell
PathData = require("path-data@0.0.2")
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