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

259
Views
Invalid data table format: must have at least 2 columns. - Ajax Google Column chart

I have problem with Invalid data table format: must have at least 2 columns. error from my code. I know there's an answer here but it's not for me.

I grabbed the idea of ajax from google but it's for pie chart. Later I found this link seems to be useful. Again, as I follow the instruction from the page - unlucky me.

Json

[
["Time","Order","Delivered","Income"],
["00:00",52327,0,52327],
["04:00",39703,0,39703],
["08:00",189949,0,189949],
["12:00",209406,0,209406],
["16:00",134622,0,134622],["20:00",121045,0,121045]
]

JS

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

  function drawChart() {
    var jsonData = $.ajax({
      url: "https://paste-bin.xyz/raw/12684",//ajax data
      dataType: "json",
      async: false
    }).responseText;

    // Create our data table out of JSON data loaded from server.
    var data = new google.visualization.DataTable(jsonData);
    var chart = new google.charts.Bar(document.getElementById('chart1'));
    chart.draw(data);
  }

According to the reference in both google and the tutorial, it should working. I also make a fiddle version here : https://jsfiddle.net/c3sd61rv/ (classic version here : https://jsfiddle.net/y5o7L0dn/1/)

about 4 years ago · Juan Pablo Isaza
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!