簡體   English   中英

圖例與地圖上的顏色不對應。 融合桌

[英]Legend not corresponding to colours on the Map. Fusion Tables

我正在使用Fusion Tables API來設置地圖樣式。 但是,在圖例中,某些國家(烏干達和莫桑比克)未顯示圖例中顯示的正確顏色。

鏈接到地圖

這是顯示圖例的代碼

    <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>

顯示地圖的代碼

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);
    });
  }

'Total No of Points'列已設置為Text類型,比較將基於不會提供預期結果的字符串進行。

簡單測試:

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

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

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM