Jvectormap area color

Im using a jvectormap plugin , and I'm trying to set the colors of each of the regions on the map. However, after applying the code, a map is displayed below, but without application. He just shows a map in white.

I read a few examples and questions on this, but I can't get it to work for me.

Example 1 setting random colors on a map.

Documentation

A similar question is for mine, however it does not solve my problem.

jQuery('#mapDiv').vectorMap({ map: 'au_merc_en', backgroundColor: 'none', colors: { AU-SA: '#4E7387', AU-WA:'#333333', AU-VIC:'#89AFBF', AU-TAS:'#817F8E', AU-QLD:'#344B5E', AU-NSW:'#344B5E', AU-ACT:'#344B5E', AU-NT:'#344B5E' }, series: { regions: [{ attribute: 'fill' }] } }); 

Can anyone see the problem?

+7
source share
2 answers

Here is a working example of what I think you are trying to do.

http://jsfiddle.net/3xZ28/34/

 (function() { var myCustomColors = { 'AU-SA': '#4E7387', 'AU-WA': '#333333', 'AU-VIC': '#89AFBF', 'AU-TAS': '#817F8E', 'AU-QLD': '#344B5E', 'AU-NSW': '#344B5E', 'AU-ACT': '#344B5E', 'AU-NT': '#344B5E' }; map = new jvm.WorldMap({ map: 'au_merc_en', container: $('#ausie'), backgroundColor: '#eff7ff', series: { regions: [{ attribute: 'fill' }] } }); map.series.regions[0].setValues(myCustomColors); })(); 

This example builds two examples on the jvectormap site:
1.http : //jvectormap.com/maps/countries/australia/
2. http://jvectormap.com/examples/random-colors/

The violin includes the jvectormap 1.1 file from the site. Also note that the Random Colors example on the site uses jvm. WorldMap

+11
source

The code below has been edited to correct syntax errors in your published code.

 jQuery('#mapDiv').vectorMap({ map: 'au_merc_en', backgroundColor: 'none', colors:{ "AU-SA": '#4E7387', "AU-WA":'#333333', "AU-VIC":'#89AFBF', "AU-TAS":'#817F8E', "AU-QLD":'#344B5E', "AU-NSW":'#344B5E', "AU-ACT":'#344B5E', "AU-NT":'#344B5E' }, series: { regions: [{ attribute: 'fill' }] } }); 

The unrelated (the closest antonym of the encapsulated I can put together) hyphens inside the keys of the object cause a syntax error. The error itself is an invalid label.

+2
source

All Articles