Platform
Resources
Pricing
Sign in
Get started
Isabel Cristina
Workspace
Fork
Published
By
Isabel Cristina
Edited
Oct 5, 2022
1
Insert cell
1
Insert cell
key
=
Swatches
(
chart
.
scales
.
color
)
Insert cell
chart
=
ForceGraph
(
imdb_data_100
,
{
width
:
width
,
height
:
800
,
nodeGroup
:
d
=>
d
.
group
,
nodeRadius
:
d
=>
radius
.
get
(
d
.
id
)
*
3
,
nodeTitle
:
d
=>
`${
d
.
id
}: ${
radius
.
get
(
d
.
id
)
}`
}
)
Insert cell
radius
=
{
const
degree
=
new
Map
(
)
;
imdb_data_100
.
nodes
.
forEach
(
d
=>
{
degree
.
set
(
d
.
id
,
1
)
}
)
imdb_data_100
.
links
.
forEach
(
d
=>
{
degree
.
set
(
d
.
target
,
degree
.
get
(
d
.
target
)
+
1
)
}
)
return
degree
}
Insert cell
imdb_data_100
=
FileAttachment
(
"imdb_data_100.json"
)
.
json
(
)
Insert cell
Insert cell
import
{
Swatches
}
from
"@d3/color-legend"
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
Show 1 comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
key
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
chart
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
radius
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
imdb_data_100
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
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