Published
Edited
Apr 12, 2020
Insert cell
Insert cell
{
const height = width / 2 + 50;
var context = (this && this.getContext("2d")) || DOM.context2d(width, height);

for (var x = 0; x < width; x++) {
context.setTransform(1, 0, 0, 1, 0, 0);
context.translate(5 * x, 1);
for (var y = 0; y < x; y++) {
if (Math.random() > .5) continue;
context.translate(0, 5);
context.fillRect(0, 0, 1, 1);
}
}

yield context.canvas;
}
Insert cell
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