title: Array to google charts
body: <p>I'm trying to pass an array of numbers to a google charts, that array is being pulled by this code from a div with a class .likescount</p>
  
  <pre><code>var i, $mvar = $('.likescount'); // using the $ prefix to use the "jQuery wrapped var" convention
  
  function logit( string )
  {
      var text = document.createTextNode( string );
      $('.alllikesinrow').append(text);
      $('.alllikesinrow').append("&lt;br&gt;");
  }
  
  logit($mvar.length);
  
  for (i=0; i&lt;$mvar.length; i++)    {
      logit($mvar.eq(i).html());
  }
  </code></pre>
  
  <p>The array is working because im using the append to print it and its working, the hard part is to pass that data to data.addRows, heres the full code i'm using, worked around it, but never got it worked, i'm following this guy that got it working <a href="https://stackoverflow.com/questions/34904482/how-to-add-data-in-google-charts-using-javascript">how to add data in google charts using javascript ?</a> , but without luck, any help wold be great.</p>
  
  <pre><code>&lt;script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"&gt;&lt;/script&gt;
  &lt;script type="text/javascript"&gt;
      google.charts.load('current', {'packages':['line']});
  google.charts.setOnLoadCallback(drawChart);
  
  
  function drawChart() {
  
      var i, $mvar = $('.likescount'); // using the $ prefix to use the "jQuery wrapped var" convention
  
      x = [];
  
      for (i=0; i&lt;$mvar.length; i++ )    {
  
          x.push( ['1', parseFloat($($mvar[i]).text())] );
      }
  
  
    var data = new google.visualization.DataTable();
    data.addColumn('string', 'Day');
    data.addColumn('number', 'Likes');
  
    data.addRows(x);
  
    var options = {
      chart: {
        title: 'Likes vs Comentarios',
        subtitle: 'Data Magnus by Optimum'
      },
  
      height: 500
    };
  
    var chart = new google.charts.Line(document.getElementById('curve_chart'));
  
    chart.draw(data, google.charts.Line.convertOptions(options), {pointSize: 1});
  }
  &lt;/script&gt;
  </code></pre>
  
  <p>Thanks Rodrigo</p>
  
  <p><strong>EDIT:</strong> Edited with a working push thanks to <strong>WhiteHat</strong></p>