如何增加此地图的大小?

时间:2010-08-16 17:19:54

标签: google-maps

<!--
  copyright (c) 2009 Google inc.

  You are free to copy and use this sample.
  License can be found here: 

http://code.google.com/apis/ajaxsearch/faq/#license
-->

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" 

"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
  <meta http-equiv="content-type" content="text/html; 

charset=utf-8" />
  <title>Google Visualization API Sample</title>
  <script type="text/javascript" 

src="http://www.google.com/jsapi"></script>
  <script type="text/javascript">
    google.load('visualization', '1', {packages: ['geomap']});

    function drawVisualization() {
      var data = new google.visualization.DataTable();
      data.addRows(6);
      data.addColumn('string', 'Country');
      data.addColumn('number', 'Popularity');

      data.setValue(1, 0, 'United 10:19 AM 8/16/2010States');
      data.setValue(1, 1, 300);
     var options = { region: 'us_metro' };

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


    google.setOnLoadCallback(drawVisualization);
  </script>
</head>
<body style="font-family: Arial;border: 0 none;">
<div id="visualization" style="width: 800px; height: 

400px;"></div>
</body>
</html>
​

2 个答案:

答案 0 :(得分:5)

关于GeoMap,this可以提供帮助

  options['width']='800';
  options['height']= '600';
  geomap.draw(data,options);

答案 1 :(得分:2)

要增加地图可视化的大小,您必须更改style <div id="visualization" ...属性中的像素值。

例如:

<body style="font-family: Arial;border: 0 none;">
<div id="visualization" style="width: 1600px; height: 800px;"></div>
</body>

另外,我注意到您使用的是Google Visualization API。除非您要显示某些图表或创建强度或地理地图,否则我建议您使用Google Maps API - 您可以操作有关地图的更多内容。