Published
Edited
Mar 2, 2022
4 stars
Insert cell
Insert cell
Insert cell
Insert cell
myModule = import(await FileAttachment("test_export.js").url())
Insert cell
Insert cell
canvas = html`<canvas></canvas>`
Insert cell
output = html`<div></div>`
Insert cell
{
output.innerHTML = JSON.stringify(myModule.draw(canvas.getContext('2d'), 20, 1,1, "red")) // using the draw method from imported module
myModule.draw(canvas.getContext('2d'), 30, 10,10, color)
}
Insert cell
viewof color = Inputs.color({label: "Favorite color", value: "#4682b4"})
Insert cell
<div><b>Output:</b> ${output}</div>
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