Merge pull request #1550 from umap-project/choropleth-min-classes

fix: do not ask more classes than available values in choropleth mode
This commit is contained in:
Yohan Boniface 2024-01-29 12:45:40 +01:00 committed by GitHub
commit cfe3bad5a4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -194,6 +194,7 @@ L.U.Layer.Choropleth = L.FeatureGroup.extend({
let mode = this.datalayer.options.choropleth.mode, let mode = this.datalayer.options.choropleth.mode,
classes = +this.datalayer.options.choropleth.classes || 5, classes = +this.datalayer.options.choropleth.classes || 5,
breaks breaks
classes = Math.min(classes, values.length)
if (mode === 'manual') { if (mode === 'manual') {
const manualBreaks = this.datalayer.options.choropleth.breaks const manualBreaks = this.datalayer.options.choropleth.breaks
if (manualBreaks) { if (manualBreaks) {