I am using google charts ,found syntax error
Unexpected Token {
<script type="text/javascript" src="https://www.google.com/jsapi"></script>
<script type="text/javascript">
google.load("visualization", "1", {packages:["corechart"]});
google.setOnLoadCallback(drawChart);
function drawChart() {
var data = google.visualization.arrayToDataTable([
['name', 'score'],
<?php
global $wpdb;
$query = $wpdb->get_results("select t2.name, count(t1.id) as score from wp3_wpsp_custom_status as t2 left join wp3_wpsp_ticket as t1 on t2.name = t1.status group by t2.name");
var_dump($query);
foreach($query as $row){
$object_array =(array)$row;
echo "['".$object_array['name']."',".$object_array['score']."],";
}
?>
]);
var options = {
title: 'Date wise visits'
};
var chart = new google.visualization.ColumnChart(document.getElementById("columnchart"));
chart.draw(data, options);
}
</script>
The above code is the basic syntax for creating a column chart. Look at the values after “var data = google.visualization.arrayToDataTable([” This one has static values. But in order to show our stats, we need to dynamically load these values from our database with php.
<body>
<h3>Column Chart</h3>
<div id="columnchart" style="width: 900px; height: 500px;"></div>
</body>
Error[![enter image description here][1]][1]