Heres my code
<?php
mysqli_connect('localhost','user','xxxxxxxxxx','dbase');
?>
<!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(booking1_date) AS count, booking1_date FROM crm
where status = 'Active' GROUP BY booking1_datete ORDER BY
CASE
WHEN booking1_date = 'Sunday' THEN 1
WHEN booking1_date = 'Monday' THEN 2
WHEN booking1_date = 'Tuesday' THEN 3
WHEN booking1_date = 'Wednesday' THEN 4
WHEN booking1_date = 'Thursday' THEN 5
WHEN booking1_date = 'Friday' THEN 6
WHEN booking1_date = 'Saturday' THEN 7
END ASC";
$exec = mysqli_query($con,$query);
while($row = mysqli_fetch_array($exec)){
echo "['".$row['booking1_date']."',".$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>
it return the error
Data column(s) for axis #0 cannot be of type string×
--
You received this message because you are subscribed to the Google Groups
"Google Chart API" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/google-chart-api.
For more options, visit https://groups.google.com/d/optout.