-
Notifications
You must be signed in to change notification settings - Fork 0
/
typo.html
30 lines (26 loc) · 1.03 KB
/
typo.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
<head>
<meta charset="UTF-8">
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Tangerine">
</head>
<script src="https://cdn.jsdelivr.net/npm/d3@7"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]" charset="utf-8"></script>
<script>
let geojson = "./world.json"
d3.json(geojson).then(data => {
let svg = geoviz.create({projection: d3.geoEqualEarth()})
svg.outline()
svg.graticule({stroke: "white", strokeWidth: 0.4})
let typo = geoviz.tool.typo(data.features.map((d) => d.properties.region), {colors: "Set3"});
svg.path({data: data, fill: (d) => typo.colorize(d.properties.region), stroke: "white", strokeWidth:0.5, tip:d => `${d.properties.NAMEen} (${d.properties.region})`})
svg.legend.typo_vertical({
pos: [670, 300],
alphabetical: true,
title: "Continents",
title_fontSize: 18,
...typo,
missing: false
});
svg.header({fontSize: 30, text: "A Typo World Map", fill: "#267A8A", fontWeight: "bold", fontFamily: "Tangerine"})
document.body.appendChild(svg.render())
})
</script>