Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Display specific map after region is clicked based on region.value parameter - Interactive Geo Maps
// replace with your map ID and region code.
let mapID=3492193;
let mapContainer=document.getElementById('map_' + mapID);
mapContainer.addEventListener('mapready', function(ev) {
iMaps.maps[mapID].series[0].mapPolygons.each(function(region) {
region.events.on("hit", function(ev) {
let data=ev.target.dataItem.dataContext;
let drillTo=parseInt(data.value);
if (Array.isArray(iMapsManager.maps[mapID].seriesById[drillTo])) {
currentRegion=iMapsManager.maps[mapID].seriesById[drillTo];
iMapsManager.drillTo(mapID, ev, currentRegion, true);
}
}, this);
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment