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 24, 2022
1 fork
1
Insert cell
Insert cell
<
svg
width
=
"500"
height
=
"200"
>
<
g
id
=
"layer1"
>
</
g
>
<!-- one at a time -->
<
g
id
=
"layer2"
transform
=
"translate(300,0)"
>
</
g
>
<!-- all together -->
</
svg
>
Insert cell
Insert cell
viewof
track
=
Inputs
.
range
(
[
0
,
4
]
,
{
label
:
"Track"
,
step
:
1
,
value
:
0
}
)
Insert cell
data
=
FileAttachment
(
"trackFeatures_sample.csv"
)
.
csv
(
)
Insert cell
fields
=
[
"danceability"
,
"energy"
,
"speechiness"
,
"liveness"
,
"valence"
]
Insert cell
onetrack
=
[
data
[
track
]
]
// just one record out of the set. "track" index chosen from range slider above
Insert cell
radarElem
=
d3
.
select
(
svgContainer
)
.
select
(
"#layer1"
)
// the svg element to put the radar in
Insert cell
radar
=
dvRadar
(
radarElem2
,
data
,
fields
,
200
,
options
)
Insert cell
options
=
(
{
maxValue
:
1
,
idField
:
"id"
,
transitionMS
:
1000
,
axisLabelShow
:
true
}
)
Insert cell
radarElem2
=
d3
.
select
(
svgContainer
)
.
select
(
"#layer2"
)
// the svg element to put the radar in
Insert cell
radar2
=
dvRadar
(
radarElem
,
onetrack
,
fields
,
200
,
options
)
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
svgContainer
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
track
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
fields
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
onetrack
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
radarElem
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
radar
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
options
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
radarElem2
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
radar2
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