Platform
Resources
Pricing
Sign in
Contact us
EarthScope Consortium
Powering Geophysics, Empowering a Resilient Society
Workspace
Fork
Public
By
Brooks Mershon
Edited
Jun 9, 2023
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
// This is our merged data as it comes from CSV files that should all share the same columns and "mergeable data".
// Think one large spreadsheet with many rows partitioned across a few .csv files.
data
=
d3
.
merge
(
// File reads are asynchronous, but we want to merge everything once it is all done.
await
Promise
.
all
(
files
.
map
(
async
(
d
)
=>
await
d
.
csv
(
{
typed
:
true
}
)
)
)
)
// Whether we sort here or in the Plot code, we need to ensure chronological order or timeseries
// data will look funky.
.
sort
(
(
a
,
b
)
=>
d3
.
ascending
(
a
.
Date
,
b
.
Date
)
)
Insert cell
Insert cell
aapl
// Built in sample dataset: https://observablehq.com/@observablehq/sample-datasets#-aapl
Insert cell
// partition data from built-in AAPL stock "observations" (timeseries data)
sample
=
{
const
k
=
3
;
let
arr
=
d3
.
range
(
k
)
.
map
(
(
d
)
=>
new
Array
(
)
)
;
aapl
.
forEach
(
(
d
)
=>
arr
[
d3
.
randomInt
(
k
)
(
)
]
.
push
(
d
)
)
;
return
arr
;
}
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
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
files
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
data
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
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
sample
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
sample0
Edit
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
sample1
Edit
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
sample2
Edit
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML