Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

253
Vistas
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
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda