I'm using patrick wied's heatmapjs.
I want to know how to destroy an instance and remove the canvas div created by h337.create(configObject) function.
Example:
var config = {
container: document.getElementById('heatmapContainer'),
radius: 10
};
var config2 = {
container: document.getElementById('heatmapContainer'),
radius: 5
};
var heatmapInstance1 = h337.create(config);
var heatmapInstance2 = h337.create(config);
var heatmapInstance3 = h337.create(config2);
I want to destroy and delete canvas div only for heatmapInstance1 instance.
Currently there is no method to destroy a heatmapjs instance, but we can do that manually.
First we have to remove the canvas element from DOM and than unset or destroy the heatmapjs instance.
Example:
//find corresponding canvas element
var canvas = heatmapInstance1._renderer.canvas;
//remove the canvas from DOM
$(canvas).remove();
//than unset the variable
heatmapInstance1 = undefined;
//or
heatmapInstance1 = null;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With