pa7 / heatmap.js

🔥 JavaScript Library for HTML5 canvas based heatmaps
https://www.patrick-wied.at/static/heatmapjs/
MIT License
6.23k stars 1.32k forks source link

Clearing all datapoints from leaflet heatmap overlay not possible #141

Open tapiokulmala opened 9 years ago

tapiokulmala commented 9 years ago

There seems to be no way to clear all datapoints from the leaflet heatmap overlay. The problem is most likely in the _update function of the leaflet heatmap overlay.

if (this._data.length == 0) { return; }

With h337 it's possible but not with heatmap overlay.

hpihkala commented 9 years ago

I hit the same issue. Worked around it by resetting the underlying heatmap directly:

this.heatmapLayer.setData(d)

if (d.data.length===0)
    this.heatmapLayer._heatmap.setData(d)
tokenflow commented 4 years ago

I know it is too late, have you tried

heatMap.setData({data:[]});