Platform
Resources
Pricing
Sign in
Get started
Eric Field
Building and Using Tools to See. UVA Architecture + Data Science. IT Director. Instructor.
Workspace
Fork
Public
d3 layout and lib examples
By
Eric Field
Edited
Apr 9
d3 layout and lib examples
dvlib_layout Overview
Line graphs
Area graphs
Sparkline
Donut or Pie
Pixel Matrix
Treemap
Pack Circles
Sunburst
Dendogram
Clusters
Word Cloud
Clusters - dynamic movement
Pack Circles - dynamic movement
Treemap - dynamic movement
Network Graph - nodes and edges
Combining Layouts - Donuts on GridMap
Radar
Rings - circle with hole mask
Beeswarm - Force Diagram
Heatmap
Pack Circles with Donuts inside
US map with Powerplant Pack Circles
Ring plot on Map - Trust Gap?
Force Directed clustering along a path
Fixed location Network Graph
Radial bar / line
Fitness rings
Curves / distance color gradient
SVG distance along path / curve
Filled Arc Polygon Bands
Connecting multiple visuals in one space
Sankey / Alluvial / Parallel Sets
Insert cell
#
Sparkline
Insert cell
<
svg
id
=
"base"
width
=
"500"
height
=
"250"
>
<
style
>
.
sparkline
{
fill
:
none
;
stroke
:
blue
;
stroke-width
:
3
;
}
</
style
>
<
g
id
=
"layer1"
transform
=
"translate(20 50)"
>
</
g
>
<
g
id
=
"layer2"
transform
=
"translate(20 150)"
>
</
g
>
</
svg
>
Insert cell
import
{
world_gdp_growth_pivot
}
from
"@emfielduva/dvlib_sampledata"
Insert cell
sortedData
=
world_gdp_growth_pivot
.
sort
(
(
a
,
b
)
=>
d3
.
ascending
(
toNum
(
a
[
"Year"
]
)
,
toNum
(
b
[
"Year"
]
)
)
)
;
Insert cell
scaleX
=
d3
.
scaleLinear
(
)
.
domain
(
[
1960
,
2012
]
)
.
range
(
[
10
,
300
]
)
Insert cell
scaleY
=
d3
.
scaleLinear
(
)
.
domain
(
[
-
20
,
20
]
)
.
range
(
[
50
,
0
]
)
Insert cell
Insert cell
Insert cell
graph1Elem
=
d3
.
select
(
svgContainer
)
.
select
(
"#layer1"
)
Insert cell
graph2Elem
=
d3
.
select
(
svgContainer
)
.
select
(
"#layer2"
)
Insert cell
mySparkLine1
=
dvSparkline
(
graph1Elem
,
sortedData
,
"Year"
,
"USA"
,
scaleX
,
scaleY
)
;
Insert cell
mySparkLine2
=
dvSparkline
(
graph2Elem
,
sortedData
,
"Year"
,
"CHN"
,
scaleX
,
scaleY
)
;
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
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
svgContainer
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
sortedData
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
scaleX
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
scaleY
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
graph1Elem
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
graph2Elem
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
mySparkLine1
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
mySparkLine2
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