可以为地图设置颜色吗?
我还想听听社区对地理编码解决方案替代方案的意见。
谢谢。
使用 geomap 的第 3 版(截至 2014 年 1 月 8 日) - 颜色从红色变为蓝色。
您可以在此处测试以下代码:
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是 googlemaps / geomap 的替代品。
可以为地图中使用的区域设置颜色。这个 API 页面解释了一切:
http://code.google.com/apis/visualization/documentation/gallery/geomap.html
作为选项对象的一部分,传入所需颜色的十六进制。例如
options['colors']=[0XEBEBEB,0XA3D5F8];
会给你这两种颜色作为基础。
您可以自定义国家、世界地图甚至背景的颜色。还要检查:
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>";
}