<html>
<head>
<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', 'Number of clicks per hari'],
<?php
$data = array(
'1'=>array('date'=>'2013-01-16','numclicks'=>'6'),
'2'=>array('date'=>'2013-01-17','numclicks'=>'9'),
'3'=>array('date'=>'2013-01-18','numclicks'=>'5'),
'4'=>array('date'=>'2013-01-19','numclicks'=>'12'),
'5'=>array('date'=>'2013-01-20','numclicks'=>'10'),
);
//$resultday = mysql_query("SELECT `date`,COUNT(idads) AS `numclicks` FROM adsmgt GROUP BY date") or die(mysql_error());
$i = 0;
//while($row = mysql_fetch_assoc($resultday)){
foreach($data as $row){
if($i == 0){
echo "['{$row['date']}', {$row['numclicks']}]";
}else{
echo ",['{$row['date']}', {$row['numclicks']}]";
}
$i++;
}
?>
]);
var options = {
title: 'Company Performance',
hAxis: {title: 'Date', titleTextStyle: {color: 'red'}}
};
var chart = new google.visualization.AreaChart(document.getElementById('chart_div'));
chart.draw(data, options);
}
</script>
</head>
<body>
<div id="chart_div" style="width: 900px; height: 500px;"></div>
</body>
</html>
Tested the hard coded array and worked, I put in what should be the code for your mysql query to work just need to uncomment and comment the foreach() line instead.
I had a play with the google graphs like 6 months back so have a little familiarity, they are very nice just very complex javascript