$dt->assignData($o);
echo $dt;
?>

function drawVisualization() {
<?php 
$dataVar = "table1";
$dataVar2 = "table2";
$dataVar3 = "table3";
$dataTable = "dataTable";
$options = null;
$chart = new Google_Chart("Table", $dataVar);
$chart->draw($dataTable, $options);
echo Google_Base::getVarById($dataVar) . "\n";
echo Google_Base::getVarById($dataVar2) . "\n";
echo Google_Base::getVarById($dataVar3) . "\n";
echo $chart;
$dataView = new Google_Data_View();
$dataView->setViewTable("dataView1");
$dataView->setDataTable($dataTable);
$dataView->setColumns(array(0, 2));
echo $dataView;
$chart2 = new Google_Chart("Table", $dataVar2);
$chart2->draw($dataView, $options);
echo $chart2;
$dataView2 = new Google_Data_View();
$dataView2->setViewTable("dataView2");
$dataView2->setDataTable($dataTable);
$dataView2->setColumns(array(0, 1, 3));
echo $dataView2;
$chart3 = new Google_Chart("Table", $dataVar3);
 /**
  * underscore
  * @desc turns a camelcased string to a lowercase underscored string
  * @param string $word
  * @access public
  * @return string
  */
 public static function underscore($word = null)
 {
     $tmp = Google_Base::replace($word, array('/([A-Z]+)([A-Z][a-z])/' => '\\1_\\2', '/([a-z\\d])([A-Z])/' => '\\1_\\2'));
     return strtolower($tmp);
 }
 /**
  * __toString
  * @desc convert an array to JSON data object
  * @return string
  */
 public function __toString()
 {
     return Google_Base::toJSON($this->values);
 }
 /**
  * sort
  * 
  * @desc Sorts the rows, according to the specified sort columns. 
  * The DataTable is modified by this method. See getSortedRows() for a 
  * description of the sorting details. This method does not return the 
  * sorted data.
  * @see getSortedRows
  * @example To sort by the third column and then by the second column, 
  * @uses data.sort([{column: 2}, {column: 1}]);
  * 
  * @param array $sortColumns 
  * @return void
  */
 public function sort(array $sortColumns)
 {
     $this->properties[__FUNCTION__][] = Google_Base::toJSON($sortColumns);
 }
 /**
  * draw
  * @desc php method to simulate Google's default draw method
  * @param array|Google_Data_View $data
  * @param array $options
  * @return void
  */
 public function draw($data, $options = null)
 {
     $this->options = $options;
     $arr = array();
     if ($data instanceof Google_Data_View) {
         $arr[] = $data->getViewTable();
     } else {
         $this->dataTable = $data;
         $arr[] = $data;
     }
     if ($options) {
         $_options = $options->getProperties();
         if ($_options instanceof Google_Config_Default or $_options instanceof stdClass) {
             $arr[] = Google_Base::toJSON($_options);
         } else {
             $arr[] = $options->getProperties();
         }
     } else {
         $arr[] = 'null';
     }
     $this->properties[__FUNCTION__][] = $arr;
 }
 /**
  * __call
  * @desc sets a property while reflecting a formatter's registry
  * @param string $name
  * @param array $parameters
  * @return void
  */
 public function __call($name, $parameters)
 {
     // analyse property name
     $methodObject = Google_Base::getMethodType($name);
     $methodType = $methodObject["type"];
     $name = $methodObject["name"];
     switch ($methodType) {
         case "set":
             $firstDown = Google_Base::ucFirstDown($name);
             $this->setProperty($firstDown, $parameters[0]);
             break;
     }
 }
 /**
  * @TODO check for removal
  * @return string
  */
 public function getData()
 {
     return Google_Base::toJson($this->configObject);
 }
 /**
  * setRows
  * @desc Sets the rows in this view based on indexes from the underlying
  * table/view. rowIndexes should be an array of numbers, greater than or
  * equal to zero, and less than the number of rows as returned by the
  * getNumberOfRows() method of the underlying table/view. The specified row
  * indexes are the indexes in the underlying table/view, which will be in
  * the view, in the specified order. Note that only  the rows specified in
  * rowIndexes will bw shown; this method clears all other rows from the view.
  * The array can also contain duplicates, effectively duplicating the specified
  * row in this view (for example, setRows([3, 4, 3, 2]) will cause row 3 to
  * appear twice in this view). The array thus provides a mapping of the rows
  * from the underlying table/view to this view.
  * @example To create a view with rows three and zero of an underlying
  * table/view: view.setRows([3, 0])
  * @param array|int $rowIndexes
  * @param int $max
  * @return void
  */
 public function setRows($rowIndexes, $max = null)
 {
     if (is_integer($max) and is_integer($rowIndexes)) {
         $this->properties[__FUNCTION__][] = '[' . $rowIndexes . ',' . $max . ']';
     } else {
         $this->properties[__FUNCTION__][] = Google_Base::toJson($rowIndexes);
     }
 }
 /**
  * render nested Google_Property Object to JSON
  * @return string
  */
 public function __toString()
 {
     return stripslashes(Google_Base::toJSON($this->properties));
 }
 /**
  * @desc table date formatter template
  * @return string
  */
 public function __toString()
 {
     $string = 'var formatter' . $this->prefix . '=new ';
     $string .= $this->provider;
     $string .= '.';
     $string .= $this->scope;
     $string .= '.';
     $string .= $this->type;
     $string .= '(' . (!empty($this->properties) ? Google_Base::toJson($this->properties) : '') . ');';
     $string .= "\n";
     $string .= 'formatter' . $this->prefix . '.format(' . $this->dataTable . ', ' . $this->srcColumnIndices . ');';
     $string .= "\n";
     return $string;
 }
 /**
  * __toString
  * @return string
  */
 public function __toString()
 {
     $string = 'var formatter=new ';
     $string .= $this->provider;
     $string .= '.';
     $string .= $this->scope;
     $string .= '.';
     $string .= $this->type;
     $string .= '(\'' . (!empty($this->pattern) ? (string) $this->pattern : '') . '\');';
     $string .= "\n";
     if (empty($this->opt_dstColumnIndex)) {
         $string .= 'formatter.format(' . $this->dataTable . ', ' . Google_Base::toJson($this->srcColumnIndices) . ');';
     } else {
         $string .= 'formatter.format(' . $this->dataTable . ', ' . Google_Base::toJson($this->srcColumnIndices) . ', ' . Google_Config::toJson($this->opt_dstColumnIndex) . ');';
     }
     $string .= "\n";
     return $string;
 }
        $query = 'SELECT A,D WHERE D > 100 ORDER BY D';
    }
} else {
    $chartType = 'AreaChart';
    $query = 'SELECT A,D WHERE D > 100 ORDER BY D';
}
$id = 'viz';
$url = 'http://spreadsheets.google.com/tq?key=pCQbetd-CptGXxxQIG7VFIQ&pub=1';
# new visualization using template default
$v = new Google_Visualization("Default");
# register package
$p = new Google_Package(array("packages" => array($chartType), "language" => "de_DE"));
$v->setPackage($p);
// set package object to visualization
# setup chart
$chart = new Google_Chart($chartType, Google_Base::getElementById($id));
$options = new Google_Config($chartType);
$options->setProperty("width", 550);
$chart->draw("data", $options);
# init functions
$f1 = new Google_Function('drawVisualization');
$f2 = new Google_Function('handleQueryResponse', array('response'));
# setup query
$q = new Google_Data_Query($url);
$q->setQuery($query);
$q->send($f2->getName());
$f1->add($q);
$f1->setCallBack();
$v->setFunction($f1);
# setup response
$qr = new Google_Data_QueryResponse();
 /**
  * @return string
  */
 public function __toString()
 {
     $string = '';
     $string .= $this->provider;
     $string .= '.';
     $string .= $this->type;
     $string .= '(';
     $string .= "'" . $this->scope . "',";
     $string .= "'" . $this->version . "',";
     $string .= !empty($this->properties) ? Google_Base::toJson($this->properties) : '';
     $string .= ');';
     return $string;
 }