bjornd / jvectormap

jvectormap.com
GNU Affero General Public License v3.0
1.39k stars 430 forks source link

Dynamic change of regionStyle.selected.fill color #373

Open Worst45 opened 8 years ago

Worst45 commented 8 years ago

Hello, Thanks for your great job.

Is there a way to change fill color after the map is initialized? (for example, in an ajax call)

I tried this, with no success: the color remain the same as in the object construction.

var mapObject = $('#map').vectorMap('get', 'mapObject');
mapObject.clearSelectedRegions();
mapObject.params.regionStyle.selected.fill = "#00FF00";
mapObject.setSelectedRegions(['FR','JP']);

Best regards

pjv03 commented 7 years ago

Hi, Need to change your code to var mapObject = $('#map').vectorMap('get', 'mapObject'); mapObject.clearSelectedRegions(); map.regions[code].element.config.style.selected.fill = = "#00FF00"; mapObject.setSelectedRegions(code);

where code = 'FR', for instance

akadirov commented 6 years ago

Thanks @pjv03 worked for me.