Hi I’m trying to listen to the events of zoom and pan in Vector Map but I can not find how to do this in the events documentation, there is a way to do this easily. Thank you.
Listening to zoom and move events on maps
Hi @ryan I think that what you are looking for is on the map documentation page, in the Listening To Custom Map Events section, is something like this:
myChart.on('mapzoom', (x)=>{
console.log("Current map zoom: ", x.data);
});
myChart.on('mapmove', (x)=>{
console.log("Current map center: ", x.data);
});
Let me know if this is what you are looking for. Best regards.
Hi guys, I’m registering the mapzoom and mapmove event handlers but I’m getting this warning on the console: Too many events attached to the visual vectorMapDiv. This may be caused by registering the same event multiple times. Please check your code
. Otherwise, everything works ok. I can just ignore the warning or I need to fix it?. Thanks
Hi @pedro, this warning as It says appears when do you attach too many event listeners to the same chart. Do you need to keep a reference to each listener that you attach to a chart to be able to call to the off
method to unregister them. See the section Unregister Events of the Events documentation for more information. Let me know if you have any other issue. Best regards.