2015-06-30 76 views
0

我需要翻譯JVectorMap中的區域名稱。我用onRegionLabelShow,但什麼也沒有發生在這裏是我的代碼:JVectorMap - 更改區域標籤

<script> 
    jQuery(function($) { 
    $(function(){ 

     var regionColor = "#ee9439" 
     color = {}; 

     color['US'] = regionColor; 
     color['FI'] = regionColor; 
     color['BY'] = regionColor; 
     color['UK'] = regionColor; 
     color['GB'] = regionColor; 

     var name = { 
     'US': 'USA', 
     'DE': 'Deutschland', 
     'RU': 'Russland' 
     } 

     $('#world-map').vectorMap({ 

     map: 'world_mill_en', 
     backgroundColor: '#00AAA1', 
     series: { 
      regions: [{ 
      values: color, 
      attribute: 'fill' 
      }] 
     }, 
     onRegionLabelShow: function(e, el, code){ 

      label.html(names[code]); 
     } 

     }); 
    }); 
    }); 
</script> 

回答

0

你在你的代碼一個錯字:你聲明數組name,但你的onRegionLabelShow試圖訪問names