1

I read the guide->updating after initial drawing part at https://github.com/markmarkoh/datamaps but updating doesn't work using string values (it works fine using fillKey property instead). I read this closed issue too: markmarkoh/datamaps#118 but nothing.

This is my code:

v

ar map = new Datamap({
    element: document.getElementById('world'),          
    geographyConfig: {
      dataUrl: 'world-topo-min.json',
      borderColor: 'black'
     },
     scope: 'countries',        
     fills: {
       defaultFill: 'rgb(255,255,255)',     
       someKey: '#08306b'
     },
    data: {
      '108': {fillKey: 'someKey'}               
    },
    setProjection: function(element) {
      var projection = d3.geo.mercator()
        .center([30, 34.4444])
        .scale(170)
        .translate([element.offsetWidth / 2 , element.offsetHeight/2]);

       var path = d3.geo.path().projection(projection);
       return {path: path, projection: projection};
    }
  });map.updateChoropleth({'57': {fillKey:'someKey'},'116': '#08306b'});

Country identificated by id=57 is ok, country 116 doesn't change

I pull data from a PHP-array like this: myarray=[[57,32],[116,12]] Country 57 has value 32, country 116 has value 12 and so on. I ignore myarray right now because I want to solve updatechoropleth issue first Obviously, I'm going to create a linear scale to put right colors into countries path but this is another thing.

Help me please Thank you guys!

4

0 回答 0