<pre><?php
include_once '../d3.classes.inc.php';
include_once '../google.classes.inc.php';
include_once '../element.php';
$employees = array(
array("Mike", new Date(2008, 1, 28)),
array("Bob", new Date(2007, 5, 1)),
array("Alice", new Date(2006, 7, 16)),
array("Frank", new Date(2007, 11, 28)),
array("Floyd", new Date(2005, 3, 13)),
array("Fritz", new Date(2007, 9, 2)),
);
$data = google()->visualization->DataTable()->createVar("data");
stack()->add($data);
stack()->add(google(true, $data->getVar())->addColumn("string", "Employee Name"));
stack()->add(google(true, $data->getVar())->addColumn("date", "Start Date"));
stack()->add(google(true, $data->getVar())->addRows(6));
foreach($employees as $index => $employee) {
stack()->add(google(true, $data->getVar())->setCell($index, 0, $employee[0]));
stack()->add(google(true, $data->getVar())->setCell($index, 1, $employee[1]));
}
$view = google()->visualization->DataView($data->getVar())->createVar("view");
stack()->add($view);
$filter = google(false, $view->getVar())
->getFilteredRows(array(array("column" => 1, "minValue" => new Date(2007, 0, 1) ) ) );
stack()->add( google(true, $view->getVar())->setRows($filter) );
$table = google()->visualization->Table(document()->getElementById("test_dataview"))->createVar("table");
stack()->add($table);
stack()->add(google(true, $table->getVar())->draw($view->getVar(), array("sortColumn" => 1)));
echo stack();
|