Platform
Resources
Pricing
Sign in
Get started
Fil
Vocateur.
Workspace
Fork
Public
Plot
By
Fil
Edited
Apr 3, 2023
3 forks
7 stars
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
hex
=
(
{
x
,
y
}
)
=>
(
{
type
:
"Polygon"
,
coordinates
:
[
Array
.
from
(
{
length
:
7
}
,
(
_
,
i
)
=>
{
const
a
=
(
Math
.
PI
*
i
)
/
3
;
const
r
=
Math
.
sqrt
(
3
)
/
3
;
return
[
+
(
x
+
Math
.
sin
(
a
)
*
r
)
.
toFixed
(
10
)
,
// rounding to avoid floating point error & vertex mismatch
+
(
y
+
Math
.
cos
(
a
)
*
r
)
.
toFixed
(
10
)
]
;
}
)
]
}
)
Insert cell
topo
=
topojson
.
topology
(
Object
.
fromEntries
(
d3
.
rollup
(
data
,
(
v
)
=>
(
{
type
:
"GeometryCollection"
,
geometries
:
v
.
map
(
hex
)
}
)
,
(
d
)
=>
d
.
color
)
)
)
Insert cell
merged
=
Object
.
entries
(
topo
.
objects
)
.
map
(
(
[
color
,
e
]
)
=>
[
color
,
topojson
.
merge
(
topo
,
e
.
geometries
)
]
)
Insert cell
topojson
=
require
(
"topojson-client@3"
,
"topojson-server@3"
)
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
merge
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
data
Edit
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
hex
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
topo
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
merged
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
topojson
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML