Google Charts Basic Map


Google Charts Basic Map

<html>
   <head>
      <title>Google Charts Tutorial</title>
      <script type = "text/javascript" src = "https://www.gstatic.com/charts/loader.js">
      </script>
      <script type = "text/javascript" src = "https://www.google.com/jsapi"></script>
      <script type = "text/javascript">
         google.charts.load('current', {packages: ['map']});     
      </script>
   </head>

   <body>
      <div id = "container" style = "width: 550px; height: 400px; margin: 0 auto">
      </div>
      <script language = "JavaScript">
         function drawChart() {
            // Define the chart to be drawn.
            var data = google.visualization.arrayToDataTable([
               ['Country', 'Population'],
               ['China', 'China: 1,363,800,000'],
               ['India', 'India: 1,242,620,000'],
               ['US', 'US: 317,842,000'],
               ['Indonesia', 'Indonesia: 247,424,598'],
               ['Brazil', 'Brazil: 201,032,714'],
               ['Pakistan', 'Pakistan: 186,134,000'],
               ['Nigeria', 'Nigeria: 173,615,000'],
               ['Bangladesh', 'Bangladesh: 152,518,015'],
               ['Russia', 'Russia: 146,019,512'],
               ['Japan', 'Japan: 127,120,000']
            ]);

            // Set chart options
            var options = {showTip: true};              

            // Instantiate and draw the chart.
            var chart = new google.visualization.Map(document.getElementById('container'));
            chart.draw(data, options);
         }
         google.charts.setOnLoadCallback(drawChart);
      </script>
   </body>
</html>