Platform
Resources
Pricing
Sign in
Get started
Simon Willison
Workspace
Fork
Published
By
Simon Willison
Edited
Apr 5, 2021
1 fork
2 stars
Insert cell
Insert cell
viewof
searched_counties
=
Search
(
await
d3
.
csv
(
counties_csv
)
)
Insert cell
viewof
selected_counties
=
Table
(
searched_counties
)
Insert cell
md
`\`\`\`json
${
JSON
.
stringify
(
selected_counties
.
map
(
c
=>
[
c
.
NAME
,
c
.
GEOID
]
)
.
slice
(
0
,
max_to_show
)
,
null
,
2
)
}
\`\`\`
${
(
selected_counties
.
length
>
max_to_show
&&
`(...truncated, ${
selected_counties
.
length
} total)`
)
||
''
}
`
Insert cell
max_to_show
=
5
Insert cell
counties_csv
=
'https://us-counties.datasette.io/counties/counties.csv?_stream=on&_size=max'
Insert cell
d3
=
require
(
"d3"
)
Insert cell
import
{
Search
,
Table
}
from
"@observablehq/inputs"
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
searched_counties
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
selected_counties
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
max_to_show
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
counties_csv
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
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML