heatmap.js icon indicating copy to clipboard operation
heatmap.js copied to clipboard

Data value of 0 is set to 1 by default in data.js

Open bbeckrest opened this issue 8 years ago • 1 comments

https://github.com/pa7/heatmap.js/blob/master/src/data.js#L29 screen shot 2016-12-09 at 3 42 39 pm

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.

bbeckrest avatar Dec 09 '16 20:12 bbeckrest

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

LePew avatar Mar 14 '17 10:03 LePew