<?php
include_once '../d3.classes.inc.php';
include_once '../google.classes.inc.php';
include_once '../element.php';
ob_start();
?><html>
<head>
<?php echo google::script();?>
<script type="text/javascript">
<?php echo google(true)->load("visualization", "1", obj(array("packages"=>array("columnchart"))));?>
<?php
$data = google()->visualization->arrayToDataTable(array(
array('Year', 'Austria', 'Belgium', 'Czech Republic', 'Finland', 'France', 'Germany'),
array('2003', 1336060, 3817614, 974066, 1104797, 6651824, 15727003),
array('2004', 1538156, 3968305, 928875, 1151983, 5940129, 17356071),
array('2005', 1576579, 4063225, 1063414, 1156441, 5714009, 16716049),
array('2006', 1600652, 4604684, 940478, 1167979, 6190532, 18542843),
array('2007', 1968113, 4013653, 1037079, 1207029, 6420270, 19564053),
array('2008', 1901067, 6792087, 1037327, 1284795, 6240921, 19830493)
));
$dataId = $data->createVar("data");
$init = google()
->visualization
->ColumnChart(document()->getElementById("chart_div"));
$chart = $init->createVar("chart", true);
$f = func();
$f->add($dataId);
$f->add($chart);
$f->add(google(true, $chart->getVar())->draw($dataId->getVar(), obj(
array(
"title" => "Yearly Coffee Consumption by Country",
"width" => 600, "height" => 400,
"hAxis" => array("title" => "Year")
)
)));
echo google::variable($f, "drawChart");
?>
<?php echo google(true)->setOnLoadCallback(google::unescape("drawChart"))?>
</script>
</head>
<body>
<div id="chart_div"></div>
</body>
</html>
<?php
$html = ob_get_contents();
ob_end_clean();
echo $html;
?>
|