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

Interpolated values between points are additive rather than averaged

Open yee379 opened this issue 9 years ago • 15 comments

i'm using h337 to visually display the temperature of our datacenter. so i have a bunch of cheapo sensors reporting temperatures scattered around our racks. when i plot the data, i notice that the points in-between the sensors appear to be additive in value: eg if two neighbouring sensors are say reporting 15C, then the area in between the two sensors (the distance between points is approximately the same distance as the radius valu) appear to be reporting a higher value of ~30C (like with constructive wave interference):

screen shot 2015-09-22 at 3 29 36 pm

for the heatmap above, i have

max: 50
radius: 13
gradient: 
  0.0: 'gray'
  0.3: 'cyan'
  0.5: 'yellow'
  0.7: 'orange'
  0.9: 'red'

for me, this is undesirable and should, for my use case, provide the average value of the overlap rather than a higher value.

yee379 avatar Sep 22 '15 22:09 yee379

Are you using the latest version of heatmap.js? (v2)

pa7 avatar Sep 23 '15 22:09 pa7

heatmap.js v2.0.0 according to the (minified) js file. just tried with v2.0.1 and it appears to be the same :(

yee379 avatar Sep 24 '15 00:09 yee379

Same issue although for a much more complex project.

bk5115545 avatar Oct 05 '15 21:10 bk5115545

Is this fixed by pull request #90?

bk5115545 avatar Jan 29 '16 21:01 bk5115545

Any updates on this?

MadStyleCow avatar Mar 14 '16 14:03 MadStyleCow

Showing average instead of sum would be great for our project too. Measuring temperature, time, quality... needs average. Thanks

juliojgarciaperez avatar Mar 31 '16 22:03 juliojgarciaperez

Hey @juliojgarciaperez & @MadStyleCow , just wanted to let you know that I'm working on resolving that issue. I tried a few approaches over the last weeks, one of them was the technique used in the mentioned PR #90 . I'm still evaluating what would be the best thing to do as all the approaches come with a ~10x performance decrease so far. Performance was one of my top priorities with heatmap.js, so I'm thinking of pushing a version where you can configure to render averages, but that's not a default setting.

pa7 avatar Apr 07 '16 10:04 pa7

Thanks @pa7, I appreciate it

juliojgarciaperez avatar Apr 08 '16 19:04 juliojgarciaperez

@pa7 @juliojgarciaperez was this issue resolved?

cpunekar avatar Jul 20 '16 23:07 cpunekar

@pa7 @juliojgarciaperez was this issue resolved?

I am using the latest version and points still sum instead of average.

PedroD avatar Jul 03 '18 19:07 PedroD

@pa7 Hi Patrick, thank you for this beautiful library. I am having the same issue when using the leaflet plugin. I am wondering if this issue has been solved. I tried @woracheth solution/version but the problem persists. I would appreciate any help in this matter.

Thank you.

This is how the heat map looks:

screen shot 2018-07-20 at 13 02 51

ErikaHD avatar Jul 20 '18 11:07 ErikaHD

@pa7 @juliojgarciaperez was this issue resolved?

I am using the latest version and points still sum instead of average.

Same issue for me because same needs to display average values. @pa7 : did you find a solution for it ? Thanks

sepatin avatar Nov 04 '18 20:11 sepatin

@pa7 @juliojgarciaperez was this issue resolved? I am using the latest version and points still sum instead of average.

Same issue for me because same needs to display average values. @pa7 : did you find a solution for it ? Thanks

Using gmaps plugin, "maxIntensity" does the job according to google. I tried and it seems to. Let me know if i'm wrong. Thanks

sepatin avatar Nov 04 '18 21:11 sepatin

Is there any solution yet. In our projet we also need this feature

MrTob avatar Mar 05 '20 08:03 MrTob

Hi @MrTob ,

For my version #90. I had commented else where. In summary, it is near impossible to do true averaging, due to HTML5 canvas technique would limit operations to do within unsigned byte integer as the RGB color would be in the range 0-255. My thought to do workaround on buffer limitation, it might be dumping canvas buffer after every canvas operation, or separating value and count to different logical canvas.

Other than my interim solution, there is WIP in the data-interpolation branch. I didn't have a look at it yet.

Woracheth avatar Mar 07 '20 16:03 Woracheth