Public
Edited
Mar 27
Insert cell
Insert cell
{
const lines = [];

cantor(0, 10, 600);

function cantor(x, y, length) {
if (length < 1) return;
lines.push({ x, y, length });
const l = length / 3;
cantor(x, y + 20, l);
cantor(x + l * 2, y + 20, l);
}

const app = cm.app({
width: 640,
height: 120,
draw: [
cm.svg("line", lines, {
x1: (d) => d.x,
y1: (d) => d.y,
x2: (d) => d.x + d.length,
y2: (d) => d.y,
stroke: "black",
strokeWidth: 2
})
]
});

return app.render();
}
Insert cell
cm = require("charmingjs@0.0.15")
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