2014-07-14 34 views
0

我使用融合表API來繪製地圖樣式。然而在傳說中,一些國家(烏干達和莫桑比克)沒有顯示圖例中顯示的正確顏色。圖例與地圖上的顏色不相對應。 Fusion Tables

Link to the map

下面是用於顯示圖例

<style type="text/css"> 
    #legend { 
    background-color: #FFF; 
    margin: 10px; 
    padding: 5px; 
    width: 150px; 
    } 

    #legend p { 
    font-weight: bold; 
    margin-top: 3px; 
    } 

    #legend div { 
    clear: both; 
    } 

    .color { 
    height: 12px; 
    width: 12px; 
    margin-right: 3px; 
    float: left; 
    display: block; 
    } 
    #map-canvas{ 

     width: 700px; 
     height: 650px; 

    } 
</style> 

代碼FOT顯示所述地圖

function initialize() { 
    var map = new google.maps.Map(document.getElementById('map-canvas'), { 
     center: new google.maps.LatLng(-2.358937, 27.618881), 
     zoom: 4, 
     mapTypeId: google.maps.MapTypeId.ROADMAP 
    }); 

    var layer = new google.maps.FusionTablesLayer({ 
     query: { 
     select: 'geometry', 
     from: '1MXudMo9A8yUjpO89hkac74LzGEKPyA_tDzkWJ3hl' 
     } 
    }); 
    layer.setMap(map); 

    initSelectmenu(); 
    for (column in COLUMN_STYLES) { 
     break; 
    } 
    applyStyle(map, layer, column); 
    addLegend(map); 

    google.maps.event.addDomListener(document.getElementById('selector'), 
     'change', function() { 
      var selectedColumn = this.value; 
      applyStyle(map, layer, selectedColumn); 
      updateLegend(selectedColumn); 
    }); 
    } 

回答

1

'Total No of Points'已被設置爲類型Text,所述比較將所述代碼基於字符串什麼不會給預期的結果。

簡單的測試:

alert('9'>'10');//true 
alert(9>10);//false 

解決方案:設置列的類型Number

+0

它的工作,謝謝。 – 1088

相關問題