title: Google Chart add data from array
body: <p>Hi guys so I'm trying to draw a chart with Google chart</p>
  
  <p>this is my code:</p>
  
  <pre><code>      google.charts.load('current', {'packages':['bar']});
    google.charts.setOnLoadCallback(drawStuff);
  
  
    function drawStuff() {
  
      var data = new google.visualization.arrayToDataTable([
  
  
        ['', 'Total: '],
  
  
        [info["name"] , info["qn"]],  //first element
        [info["name"] , info["qn"]],  //second element
  
  
      ]);
  
  
  
      var options = {
  
  
        legend: { position: 'none' },
  
        axes: {
  
        },
        bar: { groupWidth: "80%" }
      };
  
      var chart = new google.charts.Bar(document.getElementById('top_x_div'));
      // Convert the Classic options to Material options.
      chart.draw(data, google.charts.Bar.convertOptions(options));
    };
  </code></pre>
  
  <p>My question is: How can I insert data from an array to the chart? </p>
  
  <p>PS: the first element is supposed to be the first element of the array and the second element is supposed to be the second one.</p>
  
  <p>My array:</p>
  
  <pre><code>    var cont = 1;
  var rowtbl = document.getElementById("tabella").rows.length;
  rowtbl = rowtbl - 1; //number rows table
  while(cont &lt;= rowtbl){
      var nomi;
      var qnt;
      nomi = document.getElementById("tabella").rows[cont].cells[0].innerHTML;
      qnt = document.getElementById("tabella").rows[cont].cells[1].innerHTML;
      var info = {name: nomi, qn: qnt};
      cont = cont +1; 
  
  }
  </code></pre>