In this example of the heatmap.js tool, I see how the values of the heatmap is returned by using heatmapINstance.getValueAt():
demoWrapper.onmousemove = function(ev) {
var x = ev.layerX;
var y = ev.layerY;
// getValueAt gives us the value for a point p(x/y)
var value = heatmapInstance.getValueAt({
x: x,
y: y
});
tooltip.style.display = 'block';
updateTooltip(x, y, value);
};
I also see that a heatmap instance is created, the "heatmapInstance" that we are using getValueAt() on:
var heatmapInstance = h337.create({
container: document.querySelector('.heatmap'),
// onExtremaChange will be called whenever there's a new maximum or minimum
onExtremaChange: function(data) {
updateLegend(data);
}
});
I've created a heatmap layer using heatmap.js' (see picture below) leaflet-heatmap plugin, how could I display the value of my heatmap layer at the cursor location?
Best Answer
Cheers