diff options
Diffstat (limited to '')
| -rw-r--r-- | app/map.js | 9 |
1 files changed, 6 insertions, 3 deletions
@@ -817,14 +817,17 @@ export class MapEl { * @param {AreaParam} param */ updateArea(param) { - const values = this.#collection?.statisticalAreas.map((area) => area.getValue(param)); + const values = this.#collection?.statisticalAreas + .map((area) => area.getValue(param)) + .filter((x) => !Number.isNaN(x)) + .sort(); const range = { max: Math.max(...values), min: Math.min(...values) }; const statAreaPolygons = this.svg.querySelectorAll("#statistical-areas polygon"); statAreaPolygons.forEach((polygon) => { const areaId = polygon.getAttribute("data-id"); const area = this.#collection?.statisticalAreas.find((a) => a.id === areaId); - if (area) { - const value = area.getValue(param); + const value = area?.getValue(param); + if (area && value && !Number.isNaN(value)) { const normalized = MapMath.normalize(value, range.min, range.max); polygon.setAttribute( "fill", |
