<!DOCTYPE html> <html> <head> <p> </p> <script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script> <script type="text/javascript"> google.charts.load('current', {'packages':['corechart']}); google.charts.setOnLoadCallback(drawChart); function drawChart() { var data = google.visualization.arrayToDataTable([ ['Year', 'BirthRate', 'AgeGroup'], <?php while ($row = mysqli_fetch_array($result)) { //echo "[".$row["Year"].",". $row["BirthRate"]."],"; echo "[".$row["Year"].",". $row["BirthRate"] .",".$row["AgeGroup"]."],"; } ?> ]); var options = { title: 'Year by BirthRate', hAxis: {title: 'Year', minValue: 1940, maxValue: 2000}, vAxis: {title: 'BirthRate', minValue: 0, maxValue: 275}, colors: ['#a52714', '#097138'], legend: 'AgeGroup' }; var chart = new google.visualization.ScatterChart(document.getElementById('chart_div')); chart.draw(data, options); } </script> </head> <body> <div id="chart_div" style="width: 900px; height: 500px;"></div> </body> </html> Intentando hacer una visualización de gráfico de Google que represente el año por tasa de natalidad con una leyenda/clave para el grupo de edad. Recibo errores que no me permiten hacer esto como SyntaxError: identificador inesperado 'años'. Se esperaba un ']' de cierre o un ',' después de un elemento de matriz. 