Platform
Solutions
Resources
Pricing
Sign in
Sign up
Mike Bostock
Visualization toolmaker. Founder @observablehq. Creator @d3. Former @nytgraphics. Pronounced BOSS-tock.
Workspace
Fork
Published
Coronavirus
By
Mike Bostock
Edited
Apr 2, 2020
4 forks
52 stars
2
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
data
=
d3
.
cstParseRows
(
await
FileAttachment
(
"cares@2.cst"
)
.
text
(
)
,
(
[
name
,
value
]
)
=>
(
{
name
,
...
(
value
===
undefined
?
undefined
:
{
children
:
Array
.
from
(
{
length
:
Math
.
round
(
value
)
}
,
(
_
,
i
)
=>
(
{
name
:
""
,
value
:
1
/* Math.min(1, value - i) */
}
)
)
}
)
}
)
)
Insert cell
circle
=
d3
.
arc
(
)
.
innerRadius
(
0
)
.
outerRadius
(
d
=>
d
)
.
startAngle
(
-
Math
.
PI
)
.
endAngle
(
Math
.
PI
)
Insert cell
pack
=
data
=>
d3
.
pack
(
)
.
size
(
[
width
,
height
]
)
.
padding
(
d
=>
d
.
height
===
1
?
4
:
20
)
(
d3
.
hierarchy
(
data
)
.
sum
(
d
=>
d
.
value
)
.
sort
(
(
a
,
b
)
=>
b
.
value
-
a
.
value
)
)
Insert cell
function
autoBox
(
)
{
document
.
body
.
appendChild
(
this
)
;
const
{
x
,
y
,
width
,
height
}
=
this
.
getBBox
(
)
;
document
.
body
.
removeChild
(
this
)
;
return
[
x
,
y
,
width
,
height
]
;
}
Insert cell
width
=
1024
Insert cell
height
=
width
Insert cell
d3
=
require
(
"d3@5"
,
"cstree@0.0"
)
Insert cell
One platform
to build and deploy the best data apps
Experiment and prototype by building visualizations in live JavaScript notebooks. Collaborate with your team and decide which concepts to build out.
Use Observable Framework to build data apps locally. Use data loaders to build in any language or library, including Python, SQL, and R.
Seamlessly deploy to Observable. Test before you ship, use automatic deploy-on-commit, and ensure your projects are always up-to-date.
Try it for free
Learn more
Fork
View
Export
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
chart
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
circle
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
pack
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
autoBox
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
width
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
height
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