{
let svg = viz.create({
width: 800,
domain: africa,
zoomable: true,
background: "#b7e9f7",
margin: 30
});
svg.path({ datum: world, fill: "white", fillOpacity: 0.4 });
svg.path({ datum: africa, fill: "#F5DA7E", stroke: "white" });
svg.header({ text: "Population and wealth in Africa" });
svg.circle({
data: africa,
r: (d) => popradius.r(d.properties.poppct),
sort: "poppct",
fill: "#38896F",
stroke: "white"
});
svg.circle({
data: africa,
r: (d) => gdpradius.r(d.properties.gdppct),
transform: (d) =>
`translate(0, ${
popradius.r(d.properties.poppct) - gdpradius.r(d.properties.gdppct)
})`,
sort: "gdppct",
fill: "#893852",
stroke: "none"
});
svg.legend.box({
pos: [100, 400],
rect_fill: "#38896F",
label: "Share of world\npopulation in this\ncountry"
});
svg.legend.box({
pos: [100, 440],
rect_fill: "#893852",
label: "Share of world\nGDP in this\ncountry"
});
return svg.render();
}