heatmap.js
heatmap.js copied to clipboard
Bug calculating LocalExtreme in leaflet-heatmap.js
Hi. I noticed a bug in leafleat-heatmap.js, when useLocalExtrema=true, localMin is bounded to 0, even if the real local minimal value is >0. At the beginning of the loop, localMin should be initialized to localMax, not 0;
Workaround:
Line 117:
var localMin; // don't initialize localMin to 0
then from L131:
// local max is the maximum within current bounds
localMax = Math.max(value, localMax);
if(localMin==undefined){ // first initialization
localMin=localMax;
} else { //original code
localMin = Math.min(value, localMin);
}
thanks @LePew for reporting, thought I have fixed that in the past, but I did not. will push a fix soon
This issue is biting me here in 2021.