{
let k = 80;
let scale = d3.scaleSqrt(
[0, d3.max(world.features.map((d) => +d.properties.pop))],
[0, k * 0.8]
);
viz.tool.addfonts([
{
fontFamily: "TiltNeon",
url: await FileAttachment(
"TiltNeon-Regular-VariableFont_XROT,YROT.ttf"
).url()
}
]);
let svg = viz.create({
zoomable: "versor",
margin: 50,
width: 800,
projection: d3.geoOrthographic().rotate([-20, -25]).clipAngle(90)
});
svg.outline({ fill: viz.effect.radialGradient(svg) });
svg.graticule();
svg.path({
datum: world,
id: "test",
fill: "#317370"
});
svg.circle({
id: "bubbles",
data: world,
r: "pop",
fill: "#c95fa9",
tip: "$NAMEen",
k
});
svg.text({
id: "lab",
data: world,
text: "ISO3",
fill: "white",
fontFamily: "TiltNeon",
fontSize: (d) => scale(d.properties.pop)
});
svg.legend.circles_nested({
id: "legend",
pos: [5, 5],
data: world.features.map((d) => d.properties.pop),
title: "Population",
gap: 10,
values_dx: 3,
frame: true,
frame_stroke: "none",
k
});
return svg.render();
}