Platform
Resources
Pricing
Sign in
Get started
bmdatavisualisation
Workspace
Fork
Public
By
BM Data Visualisation
Edited
Feb 11, 2021
1 fork
1 star
1
Insert cell
Insert cell
Insert cell
Insert cell
html
`<style>
.tree_link {fill: none; stroke: #A0A0A0; stroke-width: 0.5;}
.node_circle {fill: #707070;}
.node_label {font-size: 10px; font-family: sans-serif;}
</style>
`
Insert cell
transition_time
=
500
;
Insert cell
animation_time
=
5000
;
Insert cell
function
new_dimensions
(
svg
)
{
const
{
x
,
y
,
width
,
height
}
=
svg
.
node
(
)
.
getBBox
(
)
;
return
{
"x"
:
x
,
"y"
:
y
,
"width"
:
width
,
"height"
:
height
}
;
}
Insert cell
data
=
d3
.
hierarchy
(
await
FileAttachment
(
"flare-2.json"
)
.
json
(
)
)
.
sort
(
(
a
,
b
)
=>
d3
.
ascending
(
a
.
data
.
name
,
b
.
data
.
name
)
)
Insert cell
vertical_tree
=
d3
.
tree
(
)
.
nodeSize
(
[
dx
,
dy
*
2
]
)
;
Insert cell
horizontal_tree
=
d3
.
tree
(
)
.
nodeSize
(
[
dx
,
dy
]
)
;
Insert cell
dx
=
10
;
Insert cell
dy
=
width
/
6
;
Insert cell
radial_tree
=
d3
.
tree
(
)
.
size
(
[
2
*
Math
.
PI
,
radius
]
)
.
separation
(
(
a
,
b
)
=>
(
a
.
parent
==
b
.
parent
?
1
:
2
)
/
a
.
depth
)
Insert cell
width
=
954
Insert cell
radius
=
width
/
2
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
chart
Edit
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
transition_time
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
animation_time
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
new_dimensions
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
vertical_tree
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
horizontal_tree
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
dx
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
dy
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
radial_tree
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
radius
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