Search code examples
javascriptjvectormap

Can't get jvectormap's setFocus method to work with region name


I am trying to focus on a specific region on the map using region name instead of latitudes and longitudes.

for example, this doesn't work for me:

map.setFocus({region: 'IN'})

Solution

  • After a lot of researching, I got this to work by doing this:

        var mapObj = $('#world-map').vectorMap('get', 'mapObject');
    
        mapObj.setFocus({region: 'IN'})