Question

I am trying to colors by group some regions in jqvmap but i cant make it work with more than one group. It always get the latest group.

var europe = {
   au: '#f10',
   cz: '#f10',
   dk: '#f10',

}
var africa = {
   eg: '#f20',
   ma: '#f20',
   za: '#f20',
   tn: '#f20',
}
var asia = {
   cn: '#f30',
   jp: '#f30',
   kr: '#f30',
}
var america = {
   ar: '#f40',
   us: '#f40',
   cl: '#f40',
}
$j('#map').vectorMap({
    map: 'world_en',
    color: '#f4f3f0',
    colors: europe,
    colors: africa,
    colors: asia,
    colors: america,
    scaleColors: ['#b6d6ff', '#005ace'],
});
Was it helpful?

Solution

Found the answer!

$j('#map').vectorMap({
  map: 'world_en',
  color: '#f4f3f0',
  scaleColors: ['#b6d6ff', '#005ace'],
});

$j('#map').vectorMap('set', 'colors', { au: '#b10', be: '#b10', bg: '#b10'});
$j('#map').vectorMap('set', 'colors', { eg: '#a20', ma: '#a20', za: '#a20'});
$j('#map').vectorMap('set', 'colors', { cn: '#f30', jp: '#f30', kr: '#f30'});
$j('#map').vectorMap('set', 'colors', { ar: '#660', us: '#660', cl: '#660'});
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top