Published
Edited
Aug 8, 2019
1 star
Insert cell
md`# Create canvas`
Insert cell
d3 = require("d3")
Insert cell
import {slider} from "@jashkenas/inputs"
Insert cell
viewof height = slider({
min: 1,
max: 1000,
step: 1,
value: 1,
title: "context height"
})
Insert cell
viewof width = slider({
min: 1,
max: 1000,
step: 1,
value: 1,
title: "context width"
})
Insert cell
{
const context = DOM.context2d(width, height);
context.fillRect(0, 0, width, height);
context.fillStyle = "#000000";

return context.canvas;
}
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