Guys, Ive been working on that too.. I got my datas from database and send
them to chart but I see a blank page when I try it in WAMP... no errors but
there is not something to see.
code:
<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([
<?php
$con = mysql_connect("localhost:3306", "reverse", "");
if (!$con) {
die('Could not connect: ' . mysql_error());
}
mysql_select_db($database, $con);
$result = mysql_query("SELECT * FROM `test` LIMIT 0 , 30");
$output = array();
while($row = mysql_fetch_array($result)) {
// create a temp array to hold the data
$temp = array();
// add the data
$temp[] = '"' . $row['Temp'] . '"';
$temp[] = '"' . $row['Humidity'] . '"';
$temp[] = '"' . $row['Light'] . '"';
// implode the temp array into a comma-separated list and add to the
output array
$output[] = '[' . implode(', ', $temp) . ']';
}
// implode the output into a comma-newline separated list and echo
echo implode(",\n", $output);
mysql_close($con);
?>
]);
var options = {
title: 'Selfcheck Stats'
};
var chart = new
google.visualization.LineChart(document.getElementById('chart_div'));
chart.draw(data, options);
}
</script>
</head>
<body>
<div id="chart_div" style="width: 900px; height: 500px;"></div>
</body>
</html>
---
Please help ;)
--
You received this message because you are subscribed to the Google Groups
"Google Visualization 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 http://groups.google.com/group/google-visualization-api.
For more options, visit https://groups.google.com/groups/opt_out.