Created
June 6, 2022 18:37
-
-
Save carmoreira/95329fd76cf3efa3774fcd57bd4ecd78 to your computer and use it in GitHub Desktop.
Display specific map after region is clicked based on region.value parameter - Interactive Geo Maps
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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