0

Google chart not displaying

Can someone please help me? I'm new with google chart and I don't know why my chart is not displaying

8th Sep 2018, 2:24 PM
Phoebe Gaufo
Phoebe Gaufo - avatar
1 Answer
0
<?php $con = mysqli_connect('localhost','root',''); mysqli_select_db($con,'occ'); ?> <!DOCTYPE HTML> <html> <head> <meta charset="utf-8"> <title> Create Google Charts </title> <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([ ['Date', 'Visits'], <?php $query = "SELECT count(course) FROM student_registration GROUP BY course"; $exec = mysqli_query($con,$query); while($row = mysqli_fetch_array($exec)){ echo "['".$row['course']."',".$row['count']."],"; } ?> ]); var options = { title: 'Date wise visits' }; var chart = new google.visualization.ColumnChart(document.getElementById("columnchart")); chart.draw(data, options); } </script> </head> <body> <h3>Column Chart</h3> <div id="columnchart" style="width: 900px; height: 500px;"></div> </body> </html>
8th Sep 2018, 2:25 PM
Phoebe Gaufo
Phoebe Gaufo - avatar