Platform
Resources
Pricing
Sign in
Contact us
Fati CHEN
Ph.D in DataViz
Workspace
Fork
Published
Graph
By
Fati CHEN
Edited
Mar 20, 2021
1
Graph
Hello Overlapping Marker Spiderfier for Leaflet
View All Actors
DrawGraph
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
EdgeNodeComponent
=
(
n
,
e
)
=>
{
const
ne
=
DefaultEdgeNodeComponent
(
n
,
e
)
;
ne
.
style
=
{
transform
:
`scale(${
baseScale
})`
}
;
return
ne
;
}
Insert cell
mutable
debug
=
null
Insert cell
Insert cell
baseScale
=
{
const
mx
=
_
.
maxBy
(
displayed
.
nodes
,
n
=>
n
.
x
+
n
.
width
/
2
)
;
const
bbwidth
=
mx
.
x
+
mx
.
width
/
2
;
return
width
/
bbwidth
;
}
Insert cell
duration
=
500
Insert cell
import
{
viewof
graph
,
width
,
DefaultEdgeComponent
,
DefaultNodeComponent
,
DefaultEdgeNodeComponent
}
with
{
height
,
bb
,
displayed
as
data
,
EdgeComponent
,
EdgeNodeComponent
,
duration
}
from
"@stardisblue/drawgraph"
Insert cell
Insert cell
bb
=
{
const
wx
=
_
.
maxBy
(
displayed
.
nodes
,
n
=>
n
.
x
+
n
.
width
/
2
)
;
const
hy
=
_
.
maxBy
(
displayed
.
nodes
,
n
=>
n
.
y
+
n
.
height
/
2
)
;
const
baseScale
=
width
/
(
wx
.
x
+
wx
.
width
/
2
)
;
return
[
0
,
0
,
width
,
baseScale
*
(
hy
.
y
+
hy
.
height
/
2
)
]
;
}
Insert cell
height
=
bb
[
3
]
>
300
?
"100%"
:
'300'
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
d3
=
require
(
'd3@5'
)
Insert cell
jszip
=
require
(
'https://bundle.run/jszip@3.4.0'
)
Insert cell
Insert cell
_
=
require
(
'lodash'
)
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
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
show_edges
Edit
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
chosen
Edit
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
actors
Edit
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
EdgeComponent
Edit
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
EdgeNodeComponent
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
debug
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
baseScale
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
duration
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
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
bb
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
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
displayed
Edit
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
datasets
Edit
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
Edit
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
jszip
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
_
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
Edit
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
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML