function drawMap(getRatio) {
const ctx = DOM.context2d(w, h);
ctx.canvas.style.maxWidth = "100%";
const path = d3.geoPath(null, ctx);
const labels = [];
for (const {properties: {name}, geometry} of geojson.features) {
if (name === 'District of Columbia') continue;
labels.push({ ...getLabelInfo(geometry, getRatio), name});
}
ctx.fillStyle = 'yellow';
ctx.beginPath();
for (const {pos, ratio} of labels) {
ctx.ellipse(pos[0], pos[1], pos.distance, pos.distance / ratio, 0, 0, Math.PI * 2, false);
ctx.closePath();
}
ctx.fill();
ctx.beginPath();
path(geojson);
ctx.lineWidth = 1;
ctx.strokeStyle = "#777";
ctx.stroke();
ctx.textAlign = 'center';
ctx.textBaseline = 'middle';
ctx.font = '10px sans-serif';
ctx.fillStyle = 'black';
for (const {pos, name} of labels) {
ctx.fillText(name, pos[0], pos[1]);
}
return ctx.canvas;
}