Platform
Resources
Pricing
Sign in
Get started
k0sh
Workspace
Fork
Published
By
k0sh
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.
Try it for free
Learn more
Fork
View
Export
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
d3
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
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
width
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML