From d696fe885f14719d718e7c379151da0fa5caf423 Mon Sep 17 00:00:00 2001 From: Yohan Boniface Date: Mon, 22 Jan 2024 11:09:30 +0100 Subject: [PATCH] fix: do not ask more classes than available values in choropleth It actually does not make sense, and it's a sanity check: some computation algorithms fail in this situation. --- umap/static/umap/js/umap.layer.js | 1 + 1 file changed, 1 insertion(+) diff --git a/umap/static/umap/js/umap.layer.js b/umap/static/umap/js/umap.layer.js index 49edb3c4..ddb467e0 100644 --- a/umap/static/umap/js/umap.layer.js +++ b/umap/static/umap/js/umap.layer.js @@ -194,6 +194,7 @@ L.U.Layer.Choropleth = L.FeatureGroup.extend({ let mode = this.datalayer.options.choropleth.mode, classes = +this.datalayer.options.choropleth.classes || 5, breaks + classes = Math.min(classes, values.length) if (mode === 'manual') { const manualBreaks = this.datalayer.options.choropleth.breaks if (manualBreaks) {