jvectorMap country colors

Kasparas Taminskas picture Kasparas Taminskas · Oct 17, 2012 · Viewed 7.8k times · Source

I'd like to please view my source. I have problem: i need to change country colors, but colors: ... feature isn't working for me. Map is white and colors don't change.

Please answer. Thanks!

<script>
jQuery.noConflict();
jQuery(function(){
  var $ = jQuery;

  $('#focus').click(function(){
    $('#map1').vectorMap('set', 'focus', 'LT');
  });
  $('#map1').vectorMap({
    map: 'world_mill_en',
    focusOn: {
      x: 0,
      y: 0,
      scale: 1
    },
    colors:          {
                    IN:'#33250B',
                    dk:'#000FFF',
                    kp:'#33250b',
                    ir:'#3f4114',
                    iq:'#525252',
                    pk:'#654511',
                    uz:'#69681c',
                    tm:'#48470d',
                    eg:'#654906',
                    az:'#083803',
                    tj:'#410a0a',
                    kg:'#545353',
                    sy:'#654511',
                    jo:'#33250b',
                    kz:'#654511',
                    lk:'#525252',
                    US:'#000000',
                                     },
    series: {
      regions: [{
        scale: ['#C8EEFF', '#0071A4'],
        normalizeFunction: 'polynomial',

      }]
    }
  });
})

Answer

bjornd picture bjornd · Oct 22, 2012

If you use version 1.1.x then your code should look like this:

$('#map1').vectorMap({
    map: 'world_mill_en',
    focusOn: {
      x: 0,
      y: 0,
      scale: 1
    },
    series: {
      regions: [{
        values: {
            IN:'#33250B',
            dk:'#000FFF',
            kp:'#33250b',
            ir:'#3f4114',
            iq:'#525252',
            pk:'#654511',
            uz:'#69681c',
            tm:'#48470d',
            eg:'#654906',
            az:'#083803',
            tj:'#410a0a',
            kg:'#545353',
            sy:'#654511',
            jo:'#33250b',
            kz:'#654511',
            lk:'#525252',
            US:'#000000'
        }
      }]
    }
});