Reputation: 2344
I am using the latest Jvectormap (1.2.2) but can't find any examples of setting all the country colors. I believe in the previous version it was simply "color:", but now this has been discontinued?
The code below works but the color part doesn't. I use a white background on my site so want all the countries to have a different color by default.
<script>
$(function(){
$('#world-map').vectorMap({
map: 'world_mill_en',
color: '#000000',
backgroundColor: '#ffffff',
series: {
regions: [{
values: {
IN:'#33250B',
US:'#003366'
}
}]
}
})
});
</script>
Upvotes: 1
Views: 2139
Reputation: 1820
To set the default color for all regions, set regionStyle.default.fill
.
Here's your code with that change:
<script>
$(function(){
$('#world-map').vectorMap({
map: 'world_mill_en',
regionStyle: { initial: { fill: '#000000' } }, //Changed this line
backgroundColor: '#ffffff',
series: {
regions: [{
values: {
IN:'#33250B',
US:'#003366'
}
}]
}
})
});
</script>
Upvotes: 0
Reputation:
i am not quiet sure what you mean, but to set all the countries colors you could use:
var regionStyling = {initial: {fill: '#128da7'},hover: {fill: "#A0D1DC"}};
jQuery('#world-map').vectorMap({
map: 'world_mill_en',
normalizeFunction: 'polynomial',
regionStyle:regionStyling,
backgroundColor: '#383f47',
series: {regions: [{values: {},attribute: 'fill'}]}
});
this works for me, also if you want to specify per country you could use:
jQuery('#world-map').vectorMap({
map: 'world_mill_en',
normalizeFunction: 'polynomial',
backgroundColor: '#383f47',
series: {regions: [{values: {"US" : "#000"},attribute: 'fill'}]}
});
Upvotes: 3