Platform
Resources
Pricing
Sign in
Contact us
Templates /
Interactive HTML Canvas
Sign up to use template
Observable
The end-to-end solution for building and hosting better data apps, dashboards, and reports.
Workspace
Published
2 collections
Edited
Sep 21, 2021
ISC
172 forks
Importers
7 stars
Insert cell
Insert cell
viewof
boxWidth
=
Inputs
.
range
(
[
0
,
1
]
,
{
label
:
"Box width"
}
)
Insert cell
canvas
=
{
const
context
=
DOM
.
context2d
(
width
,
height
)
;
context
.
fillStyle
=
"hsl(216deg 100% 13%)"
;
context
.
fillRect
(
0
,
0
,
boxWidth
*
width
,
height
)
;
context
.
canvas
.
style
.
background
=
"hsl(216deg 20% 90%)"
;
return
context
.
canvas
;
}
Insert cell
height
=
200
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.
Try it for free
Learn more
Fork
View
Export
Listed in...
Templates: Boilerplates
Observable
Templates
Observable
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
boxWidth
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
canvas
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
height
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML