Platform
Solutions
Resources
Pricing
Sign in
Sign up
ianarawjo
Human-Computer Interaction @ Cornell | Montreal | Bethlehem PA
Workspace
Fork
Published
By
ianarawjo
Edited
Apr 27, 2020
Fork of
Chord diagram
Insert cell
Insert cell
// Play around with below
chord
=
d3
.
chord
(
)
.
padAngle
(
0.08
)
.
sortSubgroups
(
d3
.
descending
)
.
sortChords
(
d3
.
descending
)
Insert cell
Insert cell
data
=
[
[
11975
,
5871
,
8916
,
2868
]
,
[
1951
,
10048
,
2060
,
6171
]
,
[
8010
,
16145
,
8090
,
8045
]
,
[
1013
,
990
,
940
,
6907
]
]
Insert cell
function
groupTicks
(
d
,
step
)
{
const
k
=
(
d
.
endAngle
-
d
.
startAngle
)
/
d
.
value
;
return
d3
.
range
(
0
,
d
.
value
,
step
)
.
map
(
value
=>
{
return
{
value
:
value
,
angle
:
value
*
k
+
d
.
startAngle
}
;
}
)
;
}
Insert cell
formatValue
=
d3
.
formatPrefix
(
",.0"
,
1e3
)
Insert cell
arc
=
d3
.
arc
(
)
.
innerRadius
(
innerRadius
)
.
outerRadius
(
outerRadius
)
Insert cell
ribbon
=
d3
.
ribbon
(
)
.
radius
(
innerRadius
)
Insert cell
color
=
d3
.
scaleOrdinal
(
)
.
domain
(
d3
.
range
(
4
)
)
.
range
(
[
"#000000"
,
"#FFDD89"
,
"#957244"
,
"#F26223"
]
)
Insert cell
outerRadius
=
Math
.
min
(
width
,
height
)
*
0.5
-
30
Insert cell
innerRadius
=
outerRadius
-
20
Insert cell
height
=
Math
.
min
(
640
,
width
)
Insert cell
d3
=
require
(
"d3@5"
)
Insert cell
One platform
to build and deploy the best data apps
Experiment and prototype by building visualizations in live JavaScript notebooks. Collaborate with your team and decide which concepts to build out.
Use Observable Framework to build data apps locally. Use data loaders to build in any language or library, including Python, SQL, and R.
Seamlessly deploy to Observable. Test before you ship, use automatic deploy-on-commit, and ensure your projects are always up-to-date.
Try it for free
Learn more
Compare fork
Fork
View
Export
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
chord
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
chart
Edit
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
data
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
groupTicks
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
formatValue
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
arc
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
ribbon
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
color
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
outerRadius
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
innerRadius
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
d3
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML