{
let africa = viz.tool.featurecollection(
world.features.filter((d) => d.properties.region == "Africa")
);
viz.tool.addfonts([
{
fontFamily: "Pacifico",
url: await FileAttachment("Pacifico-Regular.ttf").url()
}
]);
let svg = viz.create({
domain: africa,
width: 800,
margin: [20, 20, 20, 20],
background: "#C9EAFE",
fontFamily: "Pacifico"
});
svg.path({
datum: world,
fill: "grey",
fillOpacity: 0.1
});
svg.path({
datum: africa,
fill: "black",
transform: "translate(4,7)",
fillOpacity: 0.2
});
svg.path({
datum: africa,
fill: "#F7E3A1",
stroke: "white"
});
svg.header({
text: "The African continent",
fill: "#6b6969",
background_fill: "#F7E3A1",
fontSize: 60
});
let k = 50;
let scale = d3.scaleSqrt(
[0, d3.max(africa.features.map((d) => +d.properties.pop))],
[0, k * 0.6]
);
svg.text({
data: africa,
text: "NAMEen",
fill: "#6b6969",
strokeWidth: 5,
stroke: "white",
strokeOpacity: 0.7,
fontSize: (d) => scale(d.properties.pop)
});
let inset = viz.container.create({
parent: svg,
pos: [15, 510],
width: 340,
projection: await require("d3-geo-polygon").then((d) => d.geoAirocean())
});
inset.outline({
fill: "white",
strokeWidth: 1,
stroke: "#7499d6"
});
inset.graticule({
step: 30,
strokeDasharray: "none",
strokeOpacity: 0.5,
stroke: "#7499d6"
});
inset.path({
datum: world,
fill: "#a1acc2",
stroke: "none"
});
inset.path({
datum: africa,
fill: "#7499d6",
stroke: "#7499d6"
});
return svg.render();
}