Hi
I am trying to connect the google timeline chart to mysql, but I managed to
get the connection working but I am not sure how to echo the data from my
table. Could you please help me out here? Thanks
so I want to display the goals currently in the goal table I need the
goalName, starts, finish and progress. Here is the code:
<?php
session_start();
$con=mysqli_connect("localhost","root","","") or die("Error " .
mysqli_error($connection));
if (!$con) {
die('Could not connect: ' . mysql_error());
}
$query = "SELECT goalName, progress, starts, finish FROM goal";
$result = mysqli_query($con,$query) or die(mysqli_error());
list($row) = mysqli_fetch_array($result);
?>
<html>
<head>
<script type="text/javascript"
src="https://www.google.com/jsapi?autoload={'modules':[{'name':'visualization',
'version':'1','packages':['timeline']}]}"></script>
<script type="text/javascript">
google.setOnLoadCallback(drawChart);
function drawChart() {
var container = document.getElementById('example3.1');
var chart = new google.visualization.Timeline(container);
var dataTable = new google.visualization.DataTable();
dataTable.addColumn({ type: 'string', id: 'goalName' });
dataTable.addColumn({ type: 'date', id: 'starts' });
dataTable.addColumn({ type: 'date', id: 'finish' });
dataTable.addRows([
])
var data = google.visualization.arrayToDataTable([
['goalName', 'starts', 'finish','progress'<?php echo $row; ?>]
]);
var options = {
title: 'Progress',
is3D: true
};
chart.draw(datatable);
}
</script>
--
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/d/optout.