Platform
Resources
Pricing
Sign in
Get started
Jonathan Day
Workspace
Fork
Published
Covid 19
By
Jonathan Day
Edited
Apr 13, 2020
Insert cell
Insert cell
viewof
line
=
vl
.
markLine
(
)
.
width
(
750
)
.
height
(
400
)
.
data
(
all
)
.
encode
(
vl
.
x
(
)
.
fieldQ
(
"index"
)
.
axis
(
{
title
:
'Days since Countries Patient Zero'
}
)
,
vl
.
y
(
)
.
fieldQ
(
"Cases"
)
.
axis
(
{
title
:
'Deaths'
}
)
,
vl
.
color
(
)
.
fieldN
(
"Country"
)
)
.
render
(
)
Insert cell
liveDataUK
=
(
await
fetch
(
"https://api.covid19api.com/total/dayone/country/united-kingdom/status/deaths"
)
)
.
json
(
)
;
Insert cell
liveDataItaly
=
(
await
fetch
(
"https://api.covid19api.com/total/dayone/country/italy/status/deaths"
)
)
.
json
(
)
;
Insert cell
liveDataSpain
=
(
await
fetch
(
"https://api.covid19api.com/total/dayone/country/spain/status/deaths"
)
)
.
json
(
)
;
Insert cell
liveDataChina
=
(
await
fetch
(
"https://api.covid19api.com/total/dayone/country/china/status/deaths"
)
)
.
json
(
)
;
Insert cell
liveDataUsa
=
(
await
fetch
(
"https://api.covid19api.com/total/dayone/country/us/status/deaths"
)
)
.
json
(
)
;
Insert cell
Insert cell
liveDataItalyIndexed
=
(
(
)
=>
{
let
x
=
1
;
liveDataItaly
.
map
(
(
item
)
=>
{
item
.
index
=
x
;
x
++
;
return
item
;
}
)
return
liveDataItaly
;
}
)
(
)
;
Insert cell
liveDataChinaIndexed
=
(
(
)
=>
{
let
x
=
1
;
liveDataChina
.
map
(
(
item
)
=>
{
item
.
index
=
x
;
x
++
;
return
item
;
}
)
return
liveDataChina
;
}
)
(
)
;
Insert cell
liveDataSpainIndexed
=
(
(
)
=>
{
let
x
=
1
;
liveDataSpain
.
map
(
(
item
)
=>
{
item
.
index
=
x
;
x
++
;
return
item
;
}
)
return
liveDataSpain
;
}
)
(
)
;
Insert cell
liveDataUKIndexed
=
(
(
)
=>
{
let
x
=
1
;
liveDataUK
.
map
(
(
item
)
=>
{
item
.
index
=
x
;
x
++
;
return
item
;
}
)
return
liveDataUK
;
}
)
(
)
;
Insert cell
liveDataUsaIndexed
=
(
(
)
=>
{
let
x
=
1
;
liveDataUsa
.
map
(
(
item
)
=>
{
item
.
index
=
x
;
x
++
;
return
item
;
}
)
return
liveDataUsa
;
}
)
(
)
;
Insert cell
all
=
(
liveDataUKIndexed
.
concat
(
liveDataSpainIndexed
,
liveDataUsaIndexed
,
liveDataItalyIndexed
,
liveDataChina
)
)
.
sort
(
(
a
,
b
)
=>
new
Date
(
a
.
Date
)
-
new
Date
(
b
.
Date
)
)
Insert cell
import
{
vl
}
from
'@vega/vega-lite-api'
;
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
line
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
liveDataUK
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
liveDataItaly
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
liveDataSpain
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
liveDataChina
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
liveDataUsa
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
data
Edit
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
liveDataItalyIndexed
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
liveDataChinaIndexed
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
liveDataSpainIndexed
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
liveDataUKIndexed
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
liveDataUsaIndexed
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
all
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