Cannot read property 'arrayToDataTable' of undefined at Google Geo Charts

前端 未结 2 1820
我在风中等你
我在风中等你 2021-01-21 06:11

so this is my set up on my index.html. the api key has been generated at console.developers.google.com and I don\'t think that it was causing an error. the problem

2条回答
  •  刺人心
    刺人心 (楼主)
    2021-01-21 06:36

    Hi try with this console online for web html js css :

    google.load("visualization", "1", {packages:["corechart"]});
          google.setOnLoadCallback(drawStuff);
          function drawStuff() {
            var data = google.visualization.arrayToDataTable([
                ["Code", "Name", "Value"],
                ["PH-14", "Autonomous Region in Muslim Mindanao (ARMM)", 1],
                ["PH-05", "Bicol (Region V)", 2],
                ["PH-02", "Cagayan Valley (Region II)", 3],
                ["PH-40", "Calabarzon (Region IV-A)",4 ],
                ["PH-13", "Caraga (Region XIII)", 5],
                ["PH-03", "Central Luzon (Region III)", 6],
                ["PH-07", "Central Visayas (Region VII)", 7],
                ["PH-15", "Cordillera Administrative Region (CAR)", 8],
                ["PH-11", "Davao (Region XI)", 9],
                ["PH-08", "Eastern Visayas (Region VIII)", 10],
                ["PH-01", "Ilocos (Region I)", 11],
                ["PH-41", "Mimaropa (Region IV-B)", 12],
                ["PH-00", "National Capital Region Pambansang Punong", 13],
                ["PH-10", "Northern Mindanao (Region X)", 14],
                ["PH-12", "Soccsksargen (Region XII)", 15],
                ["PH-06", "Western Visayas (Region VI)", 16],
                ["PH-09", "Zamboanga Peninsula (Region IX)", 17]
              ]);
    
              // Set chart options
              var options = {
                'region': 'PH',
                'resolution': 'provinces',
                'title': 'How Much Pizza I Ate Last Night',
                'width': 400,
                'height': 300
              };
    
            var chart = new google.visualization.GeoChart(document.getElementById('chart_div'));
            chart.draw(data, options);
          }
    
    

提交回复
热议问题