2010-04-27 143 views
2

是否可以爲geomap設置顏色?如何設置Google地理區域的區域顏色?

另外我想聽取關於地理編碼解決方案中的替代方案的社區意見。

謝謝。

+0

顏色是什麼?你是用GPolygon製作自定義多邊形還是什麼? – 2010-04-27 13:27:45

+1

請閱讀主題... – omoto 2010-05-03 18:16:10

回答

0

隨着你的選擇部分對象傳遞在十六進制爲你想要的顏色。例如
options ['colors'] = [0XEBEBEB,0XA3D5F8];
會給你這兩種顏色作爲基礎。

1

隨着geomap的版本3(截至2014年1月8日) - 顏色從紅色變爲藍色。

可以測試下面的代碼here

function drawVisualization() { 
    var data = google.visualization.arrayToDataTable([ 
    ['Country', 'Borat Sightings'], 
    ['United States', 3], 
    ['United Kingdom', 4], 
    ['Kazakhstan', 7] 
    ]); 
    var options = { 
     colors: [0xff0000, 0x0000ff] 
     }; 

    var geomap = new google.visualization.GeoMap(
     document.getElementById('visualization')); 
    geomap.draw(data, options); 
} 

另外,MapBox是谷歌地圖/地理分佈圖的替代品。

0

您可以自定義國家,世界地圖,甚至背景的顏色。也 檢查:

private void functionMap() { 

        "<html xmlns=\"http://www.w3.org/1999/xhtml\"><head><meta http-equiv=\"Content-Type\" content=\"text/html,width=device-width,user-scalable=yes; charset=windows-1252\">\n" + 
        " <script type=\"text/javascript\" src=\"https://www.google.com/jsapi\"></script>\n" + 
        " <script type=\"text/javascript\">\n" + 
        "  google.load('visualization', '1', {'packages': ['geochart']});\n" + 
        "  google.setOnLoadCallback(drawRegionsMap);\n" + 
        "\n" + 
        "  function drawRegionsMap() {\n" + 
        "  var data = google.visualization.arrayToDataTable([\n" + 
        "   ['Country', ''],\n" 




        "  ]);\n" + 
        "\n" + 
        "  var options = {};\n" + 
        "\t\toptions = { \n" + 
        "     datalessRegionColor: '#29ABE2',\n" + 
        "\t\t\t\t backgroundColor: '#F3F3F3',\n" + 
        "\t\t\t\t\tcolorAxis: {colors: ['#0071BC']},\n" + 
        "     keepAspectRatio: false,     \n" + 
        "     legend: false,\n" + 
        "     tooltip: { textStyle: { color: '#0099CB', fontName: 'Arial', fontSize: '10'} }\n" + 
        "    };\n" + 
        "\t\t\n" + 
        "  var chart = new google.visualization.GeoChart(document.getElementById('chart_div'));\n" + 
        "  chart.draw(data, options);\n" + 
        " };\n" + 
        " </script>\n" + 
        " </head>\n" + 
        " <body>\n" + 
        " <div id=\"chart_div\" style=\"width: 100%; height: 100%;\"><div style=\"position: relative;\"><div dir=\"ltr\" style=\"position: relative; width: 100%; height: 100%;\"><div style=\"position: absolute; left: 0px; top: 0px; width: 100%; height: 100%;\"></div></div></div></div>\n" + 
        " \n" + 
        "</body></html>"; 

}