Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

286
Views
JavaScript, PHP Google charts Uncaught TypeError: google.visualization.PieChart is not a constructor

Good morning, I have the following problem with Google Charts, I have created a script to load data in the chart through json and ajax, once the data is loaded, I can see them through console.log but when showing the graph it gives me the mistake..THANKS

Uncaught TypeError: google.visualization.PieChart is not a constructor

    <script type="text/javascript">


google.charts.load('current', {'packages':['line']});
google.charts.setOnLoadCallback(drawChart);
    
    

function drawChart() {



  $.ajax({
    url: "data.php?ne=<? echo $equipo;?>",
    dataType: "json",
    success: function (jsonData) {
        var data = new google.visualization.DataTable();
        // assumes "word" is a string and "count" is a number
  data.addColumn('number', 'Day');
  data.addColumn('number', 'C1');
  data.addColumn('number', 'C2');
  data.addColumn('number', 'C3');
        
        

        for (var i = 0; i < jsonData.length; i++) {
            
            console.log(jsonData[i]['c1'])
            data.addRow([jsonData[i]['number'], 50, 5, 3]);
        }

       var options = {
    chart: {
      title: '<? echo $equipo;?>',
    },
    width: 300,
    height: 200,
    legend: {position: 'none'}
      
  };
        var chart = new google.visualization.PieChart(document.getElementById('<? echo $equipo;?>'));
        chart.draw(data, options);
    }
});
    
    
}
about 4 years ago · Santiago Trujillo
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!