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.
This commit is contained in:
parent
7729035288
commit
d696fe885f
1 changed files with 1 additions and 0 deletions
|
@ -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) {
|
||||||
|
|
Loading…
Reference in a new issue