heatmap.js
heatmap.js copied to clipboard
Data value of 0 is set to 1 by default in data.js
https://github.com/pa7/heatmap.js/blob/master/src/data.js#L29
When you have data containing values of 0, dataPoint[this._valueField]
evaluates to 0
, which is falsey and defaults the value to 1, causing the heatmap to be wrong, especially if your max data value is 1.
Here is a fix I use. I don't know if it's the right way to do it :)
(replace L29):
var value = dataPoint[this._valueField]==undefined ? 1 : dataPoint[this._valueField]; // If point has no value set, fallback to 1, else use the value provided