세계 지도와 각국의 인구 수례

9815 단어 JavaScript
world.html
<html>
  <head>
    <meta charset="UTF-8">
    <script type="text/javascript" src="https://www.google.com/jsapi"></script>
    <script type="text/javascript">
      google.load("visualization", "1", {packages:["geochart"]});
      google.setOnLoadCallback(drawRegionsMap);

      function drawRegionsMap() {
        var data = google.visualization.arrayToDataTable([
          ['Country', 'Human'],
          ['Japan', Math.floor((Math.random() * 1000000))],
          ['United States', Math.floor((Math.random() * 1000000))],
          ['Germany', Math.floor((Math.random() * 1000000))],
          ['United Kingdom', Math.floor((Math.random() * 1000000))],
          ['Italia', Math.floor((Math.random() * 1000000))],
          ['France', Math.floor((Math.random() * 1000000))],
          ['Canada', Math.floor((Math.random() * 1000000))],
          ['Spain', Math.floor((Math.random() * 1000000))],
          ['Aus', Math.floor((Math.random() * 1000000))],
          ['Brazil', Math.floor((Math.random() * 1000000))],
          ['Portugal', Math.floor((Math.random() * 1000000))],
          ['Rusia', Math.floor((Math.random() * 1000000))],
          ['Mexico', Math.floor((Math.random() * 1000000))],
          ['India', Math.floor((Math.random() * 1000000))]
        ]);

        var options = {};
        var chart = new google.visualization.GeoChart(document.getElementById('regions_div'));
        chart.draw(data, options);
      }
    </script>
  </head>
  <body>
    <div id="regions_div" style="width: 900px; height: 500px;"></div>
  </body>
</html>

좋은 웹페이지 즐겨찾기