Platform
Resources
Pricing
Sign in
Get started
Hongtao Hao
Workspace
Fork
Public
tutorials
By
Hongtao Hao
Edited
Mar 31, 2021
10 stars
Insert cell
Insert cell
Insert cell
Insert cell
{
const
svg
=
d3
.
create
(
"svg"
)
.
attr
(
"width"
,
"500"
)
.
attr
(
"height"
,
"200"
)
.
attr
(
"id"
,
"svg"
)
;
let
rect
=
svg
.
append
(
"rect"
)
.
attr
(
"x"
,
"220"
)
.
attr
(
"y"
,
"80"
)
.
attr
(
"width"
,
"100"
)
.
attr
(
"height"
,
"50"
)
.
attr
(
"class"
,
"rect"
)
;
return
svg
.
node
(
)
;
}
Insert cell
Insert cell
html
`
<style type="text/css">
#svg {
background-color: black;
}
.rect {
fill: white;
}
</style>
`
Insert cell
Insert cell
d3
=
require
(
"d3@6"
)
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
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
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