Public
Edited
Feb 8, 2022
Insert cell
Insert cell
canvas = {
const cx = DOM.context2d(width, height);

// Use coordinates with the origin in the centre, and the y-axis pointing up
cx.transform(100,0,0,-100,width/2,height/2);

for (let i = 0; i < 6; ++i) {
cx.beginPath();
cx.lineWidth=.02;
cx.moveTo(-.5, Math.sqrt(3)/2);
cx.lineTo(.5, Math.sqrt(3)/2);
cx.stroke();

cx.beginPath();
cx.lineWidth=.01;
cx.moveTo(-5/6,Math.sqrt(3)/6);
cx.lineTo(5/6,Math.sqrt(3)/6);
cx.stroke();
cx.rotate(Math.PI/3);
}

return cx.canvas;
}
Insert cell
height = 500
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