diff --git a/plugin-designs/country-posters/countries-map.vue b/plugin-designs/country-posters/countries-map.vue index d4bf4ce10..698bfd772 100644 --- a/plugin-designs/country-posters/countries-map.vue +++ b/plugin-designs/country-posters/countries-map.vue @@ -1332,7 +1332,14 @@ async function openPacket() { // separate document and an object URL created here would be revoked out from under it. const spec = defaultPosterSpec({ widthIn: 8.27, heightIn: 11.69, dpi: 150, orientation: 'portrait' }) spec.slots.title = { ...spec.slots.title, text: legendTitle.value || 'Doxa Map' } - spec.slots.legend = { ...spec.slots.legend, rows: legend?.rows?.value || [] } + // ★ useLegendData returns `items`, not `rows`: `legend.rows` was undefined, so `|| []` handed the + // renderer an empty list and this page printed its live map with no legend. Child tiers flattened in, + // as research-map's poster does, so the printed legend names every band the map draws. + const legendRows = (legend?.items?.value || []) + .flatMap((it) => [it, ...(it.children || [])]) + .map((r) => ({ label: r.label, color: r.color })) + .filter((r) => r.label) + spec.slots.legend = { ...spec.slots.legend, rows: legendRows } let mapSvg = '' try { const mapBlob = await useMapPoster(() => map.value).render(spec, 'png')