please help me with this. though i am successful in plotting data but the graph is not properly drawn . i guess there's an issue with intervals.
x axis interval as : aug 30 , aug 31 , sep 01 , sep 02 and so on.....
y axis interval as : 0 , 10 , 20 ,30 ....
my code goes like this :
<?php
include('dbconnect.php');
$sql_data = mysql_query("SELECT date , sales FROM analytics WHERE
id ='12345' ORDER BY date ASC");
?>
<html>
<head>
<?php
echo "<script type=text/javascript>";
echo "google.load(\"visualization\", \"1\", {packages:[\"corechart\"]});";
echo "google.setOnLoadCallback(drawChart);";
echo "function drawChart() { ";
echo "var data = google.visualization.arrayToDataTable([
['Date', 'Score'],";
while($result = mysql_fetch_array($sql_data))
{
$t1 = strtotime($result['date']);
$t2 = date("d",$t1);
$display .= "[".$t2.",".$result['sales']."],";
}
$display .= " ]);";
echo $display;
echo "var options = {
title: 'Sales Analysis' ,
vAxis: {title: \"sales\"},
hAxis: {title: \"date\"} ,
};";
echo "var chart = new google.visualization.LineChart(document.getElementById('chart_div'));";
echo "chart.draw(data, options);";
echo "}
</script>";
?>
</head>
<body>
<div id="chart_div" style="width: 900px; height: 500px;"></div>
</body>
</html>