Platform
Resources
Pricing
Sign in
Get started
Data viz
Workspace
Fork
Public
By
Reanna
Edited
Mar 27, 2024
Insert cell
Insert cell
randNums
=
{
let data = [];
for (let i=0; i<count; i++) {
data.push(Math.round(Math.random()*500))
}
return data;
}
Insert cell
count
=
8
Insert cell
Insert cell
numsSVG
=
d3
.
create
(
"svg"
)
.
attr
(
"height"
,
300
)
.
attr
(
"width"
,
300
)
Insert cell
text
=
numsSVG
.
selectAll
(
"text"
)
.
data
(
randNums
)
.
join
(
"text"
)
.
transition
(
)
.
duration
(
1000
)
.
text
(
d
=>
d
)
.
style
(
"text-anchor"
,
"middle"
)
.
attr
(
"x"
,
d
=>
d
)
.
attr
(
"y"
,
(
d
,
i
)
=>
i
)
;
Insert cell
circles
=
numsSVG
.
selectAll
(
"circle"
)
.
data
(
randNums
)
.
join
(
"circle"
)
.
transition
(
)
.
duration
(
1000
)
.
style
(
"fill"
,
"none"
)
.
style
(
"stroke"
,
"steelblue"
)
.
attr
(
"r"
,
d
=>
d
/
10
)
.
attr
(
"cx"
,
d
=>
d
)
.
attr
(
"cy"
,
(
d
,
i
)
=>
15
+
i
*
d
)
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
randNums
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
count
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
numsSVG
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
text
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
circles
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML