Data Source Requests
<?php
include_once 'config.inc.php';
?><html>
<head>
<title>Data Source Requests</title>
<?php
$id = 'viz';
$url = 'http://spreadsheets.google.com/tq?key=pCQbetd-CptGXxxQIG7VFIQ&range=B1:D11&pub=1';
# new visualization using template default
$v = new Google_Visualization("Default");
# register package
$p = new Google_Package();
$p->packages = array("intensitymap");
$p->language = "de_DE";
$v->setPackage($p); // set package object to visualization
# setup chart
$chart = new Google_Chart("IntensityMap", Google_Base::getElementById($id));
$chart->draw("data");
# init functions
$f1 = new Google_Function('drawVisualization');
$f2 = new Google_Function('handleQueryResponse', array('response'));
# setup query
$q = new Google_Data_Query($url);
$q->send($f2->getName());
$f1->add($q);
$f1->setCallBack();
$v->setFunction($f1);
# setup response
$qr = new Google_Data_QueryResponse();
$qr->asVar( $chart->getDataTable() )->getDataTable();
$f2->add($qr->render(true));
$chart->setDataTable("visualization");
$f2->add($chart->render());
$v->addFunction($f2);
echo $v->render();
?>
</head>
<body style="font-family: Arial;border: 0 none;">
<h1>Data Source Requests</h1>
<div id="<?php echo $id;?>" style="border:2px solid #ccc; margin:0 30px 30px 0;height: 400px; width: 400px;"></div>
<div style="margin:10px"><?php highlight_string(file_get_contents(basename(__FILE__)));?></div>
</html>