How do I set the color of an area in Google Geomap?

Can a color be set for geomass?

Also, I would like to hear community feedback on alternatives in Geo Coding solutions.

Thanks.

+2


a source to share


4 answers


You can set the color for the areas used in the geomap. This API page explains everything:



http://code.google.com/apis/visualization/documentation/gallery/geomap.html

+1


a source


With version 3 of geomap (starting from 8Jan2014) - the color fades from red to blue.

You can test the following code 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);
}

      

Besides, MapBox is an alternative to googlemaps / geomap.

+1


a source


As part of your options object, pass in the desired colors in hexadecimal format. For example, parameters ['colors'] = [0XEBEBEB, 0XA3D5F8]; in this case, you will get these two colors as a base.

0


a source


You can customize the colors of the country, the world map, even the background. Also check:

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

}

      

0


a source







All Articles