0
So it’s the following guys, I have 2 array variables that have been converted from php to javascript, so far everything ok. I used Alert to see if it showed and worked. What I intended was to store these 2 arrays within the date variable.
< script type = "text/javascript"
src = "https://www.gstatic.com/charts/loader.js" > < /script>
  <
  script type = "text/javascript" >
  <?php
$sql2 = "SELECT tag,contador FROM tags";
$result2 = $mysqli->query($sql2);
$tagparatudo = array();
$contadorparatudo = array();
while ($row2 = $result2->fetch_assoc())
  {
  $tagparatudo[] = $row2["tag"];
  $contadorparatudo[] = $row2["contador"];
  }
  $js_array = json_encode($tagparatudo);
  $array2 = json_encode($contadorparatudo);
  echo "var tags = ". $js_array. ";\n";
  echo "var contagem = ". $array2. ";\n";
  ?>
alert(contagem);
alert(tags);
// Load google charts
google.charts.load('current', {
  'packages': ['corechart']
});
google.charts.setOnLoadCallback(drawChart);
// Draw the chart and set the chart values
function drawChart() {
  var data = google.visualization.arrayToDataTable([
    ['Something', 'Here'],
    ['Work', 5],
    ['Newthing', 5],
    ['Newthingz', 5]
  ]);
  // Optional; add a title and set the width and height of the chart
  var options = {
    'title': 'Tag Ranks',
    'width': 450,
    'height': 400
  };
  // Display the chart inside the <div> element with id="piechart"
  var chart = new google.visualization.PieChart(document.getElementById('piechart'));
  chart.draw(data, options);
} <
/script><div id="piechart"></div>A google Chart will be created with the values of the variable date and what I intended was something like :
function drawChart() {
  var data = google.visualization.arrayToDataTable([
    ['Something', 'Here'],
um ciclo for{
        [array tags, array contagem]
}
  ]);
Can someone help me? ;)
– Mickael Gonçalves