Heres what I did for an Annotated Time Line using MySQL + PHP:
<?php
$conn = mysql_connect($dbhost, $dbuser, $dbpass) or die ('Error
connecting to mysql');
mysql_select_db($dbname);
$int_y_pos = -1;
$int_y_step_small = 1;
$sql = "SELECT count(id) AS count, DATE_FORMAT(date, '%Y, %m-1, %d')
AS date FROM dtt WHERE date NOT LIKE '0000-00-00 00:00:00' AND date
NOT LIKE '2000-00-00 00:00:00' GROUP BY DATE_FORMAT(date, '%Y, %m,
%d')";
$sql = mysql_query($sql);
$rownum = mysql_num_rows($sql);
?>
<html>
<head>
<script type="text/javascript" src="
http://www.google.com/jsapi"></
script>
<script type="text/javascript">
google.load("visualization", "1", {packages:
["annotatedtimeline"]});
google.setOnLoadCallback(drawData);
function drawData() {
var data = new google.visualization.DataTable();
data.addColumn('date', 'Date');
data.addColumn('number', 'Repairs');
<?php
echo " data.addRows($rownum);\n";
while($row = mysql_fetch_assoc($sql)) {
$int_y_pos += $int_y_step_small;
echo " data.setValue(" . $int_y_pos . ", 0, new Date(" .
$row['date'] . "));\n";
echo " data.setValue(" . $int_y_pos . ", 1," . $row['count'] . ");
\n";
}
?>
var time = new
google.visualization.AnnotatedTimeLine(document.getElementById('time_div'));
time.draw(data, {displayExactValues:true});
}
</script>
</head>
<body>
<div id="time_div" style="width: 940px; height: 240px;"></div>
</body>
</html>
On Oct 17, 5:19 am, VizGuy <
viz...@google.com> wrote:
> In our examples there is no such an example, because they only web pages.
> What you want to do, is to generate on your server, where you create the
> dynamic html page, a javascript code which is similar to the pages we have
> in our docs (for instance:
http://code.google.com/apis/visualization/documentation/gallery/inten...
> )