Login   Register  
PHP Classes
elePHPant
Icontem

File: Template/Base.phtml

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Tom Schaefer  >  QGoogleVisualizationAPI 2009  >  Template/Base.phtml  >  Download  
File: Template/Base.phtml
Role: Auxiliary script
Content type: text/plain
Description: Base Layout Template
Class: QGoogleVisualizationAPI 2009
Generate charts with Google Visualization API
Author: By
Last change:
Date: 5 years ago
Size: 1,357 bytes
 

Contents

Class file image Download
<script src="<?php echo Google_Visualization::APISCRIPT?>"></script>
<script>
var cObj = <?php
if(is_array($configObject)):
    echo 
'[';
    foreach(
$configObject as $i => $o):
        if(
$i>0) echo ",";
        echo 
$o;
    endforeach;
    echo 
'];';
?>

function draw() {
  var dataObj = <?php echo $dataObject->getData()?>;
  var data = new google.visualization.DataTable(dataObj, 0.5);
  var eStr = 'new '+cObj[0].provider+'.'+cObj[0].scope+'.'+cObj[0].type+'(document.getElementById("'+cObj[0].port+'"))';
  visualization = eval(eStr);
  visualization.draw(data, cObj[0].props);
}
var cPackages=[];
var j=cObj.length;
for(var i=0;i<j;i++){cPackages.push(cObj[i].type.toLowerCase());}
google.load(cObj[0].scope, cObj[0].version,{'packages': cPackages, 'language':cObj[0].language});
google.setOnLoadCallback(draw);
<?php
else:
    echo 
$configObject.";\n";
?>
function draw() {
  var dataObj = <?php echo $dataObject->getData()?>;
  var data = new google.visualization.DataTable(dataObj, 0.5);
  var eStr = 'new '+cObj.provider+'.'+cObj.scope+'.'+cObj.type+'(document.getElementById("'+cObj.port+'"))';
  visualization = eval(eStr);
  visualization.draw(data, cObj.props);
}
google.load(cObj.scope, cObj.version,{'packages': [cObj.type.toLowerCase()], 'language':cObj.language});
google.setOnLoadCallback(draw);
<?php endif; ?>
</script>