Skip to content

Instantly share code, notes, and snippets.

@carmoreira
Created June 6, 2022 18:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save carmoreira/95329fd76cf3efa3774fcd57bd4ecd78 to your computer and use it in GitHub Desktop.
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
// 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