choro
? Plot.geo(unemployment, {
strokeWidth: 0.2,
geometry: "0",
fill: "1",
render: function (index, scales, values, dimensions, context, next) {
const g = next(index, scales, values, dimensions, context);
const I = new Map(values.geometry.map((d, i) => [d, i]));
const path = d3.geoPath(context.projection).digits(1);
fetch(`https://flatgeobuf.org/test/data/UScounties.fgb?${Math.random()}`).then(
async (response) => {
let c = 0;
for await (let feature of flatgeobuf.deserialize(response.body)) {
const i = I.get(`${feature.properties.STATE_FIPS}${feature.properties.COUNTY_FIP}`);
g.children[i]?.setAttribute("d", path(feature));
}
}
);
return g;
}
}).plot({
projection: "albers-usa",
color: {
type: "quantize",
n: 9,
domain: [1, 10],
scheme: "blues",
label: "Unemployment rate (%)",
legend: true
}
})
: new Promise(() => {})