Public
Edited
Dec 21, 2022
Insert cell
Insert cell
viewof context = {
const canvas = html`<canvas>`;
canvas.value = canvas.getContext("2d");
return canvas;
}
Insert cell
height = 300
Insert cell
image = context.createImageData(width, height)
Insert cell
{
Array2D([2, 2])
context.fillStyle = `crimson`;
context.fillRect(0, 0, 100, 100);
}
Insert cell
class Grid {
constructor(array2d, iterator = (e, [x, y]) => {}) {
const canvas = html`<canvas>`;
const ctx = canvas.getContext("2d");
canvas.value = ctx;

const image = context.createImageData(array2d[0].length, array2d.length);

return canvas;
}

static from({ num_cols, num_rows }, iterator) {
return new Grid();
}
}
Insert cell
default_iterator = (e, [x, y]) => {
return
}
Insert cell
g = new Grid([
[1, 2],
[3, 4]
])
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