Platform
Resources
Pricing
Sign in
Get started
Steve Pegg
Mainly coding for fun these days!
Workspace
Fork
Public
By
Steve Pegg
Edited
Jan 26, 2023
2
Insert cell
Insert cell
datan
=
FileAttachment
(
"data2.txt"
)
.
text
(
)
Insert cell
data
=
JSON
.
parse
(
datan
)
Insert cell
electionYears
=
d3
.
nest
(
)
.
key
(
(
d
)
=>
d
.
years
)
.
entries
(
data
)
.
map
(
(
d
)
=>
d
.
key
)
.
sort
(
d3
.
ascending
)
Insert cell
d3
=
require
(
"d3@6"
)
Insert cell
test
=
d3
.
groups
(
data
,
d
=>
d
.
years
)
// .sort(d3.ascending)
Insert cell
test2
=
[
...
new
Set
(
data
.
map
(
d
=>
d
.
years
)
)
]
;
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
datan
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
electionYears
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
test
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
test2
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML