<?php include_once 'Google.merge.v_1_0.php'; ?> <html> <head> <script type="text/javascript" src="http://www.google.com/jsapi"></script> <script type="text/javascript"> google.load('visualization', '1', {packages: ['table']}); </script> <script> <?php $o = new Google_Data_Base(); $o->addColumn("0", "Name", "string"); $o->addColumn("1", "Age", "string"); $o->addColumn("2", "Instrument", "string"); $o->addColumn("3", "Color", "string"); $o->addNewRow(); $o->addStringCellToRow("John"); $o->addStringCellToRow(24); $o->addStringCellToRow("Guitar"); $o->addStringCellToRow("Blue"); $o->addNewRow(); $o->addStringCellToRow("Paul"); $o->addStringCellToRow(25); $o->addStringCellToRow("Guitar"); $o->addStringCellToRow("Red"); $o->addNewRow(); $o->addStringCellToRow("George"); $o->addStringCellToRow(22); $o->addStringCellToRow("Bass");
include_once '../config.inc.php'; $v = new Google_Visualization("Gauge"); $c = new Google_Config("Gauge"); $o = new Google_Data_Base(); // config $c->defaultConfig("MyTestGauge"); $c->setProperty("min", 0); $c->setProperty("max", 280); $c->setProperty("yellowFrom", 200); $c->setProperty("yellowTo", 250); $c->setProperty("redFrom", 250); $c->setProperty("redTo", 280); $c->setProperty("minorTicks", 5); $v->setConfig($c); // data $o->addColumn("0", "Engine", "number"); $o->addColumn("1", "Torpedo", "number"); $o->addNewRow(); $o->addNumberCellToRow(120, "400.0"); $o->addNumberCellToRow(80, "400.0"); $v->setData($o); ?> <html> <head> <?php echo $v->render(); ?> </head> <body> <div id="chart"></div> <input type='button' value='Go Faster' onclick='changeTemp(1)' />
// config $c = new Google_Config("Table"); $c->setProperty("allowHtml", true); // format $f = Google_Format::factory("Bar"); $f->min = -10000; $f->max = 10000; $f->drawZeroLine = true; $f->colorNegative = 'red'; $f->showValue = false; $f->width = 250; $f->format("data", 1); $c->setProperty("showRowNumber", true); // data $o = new Google_Data_Base(); $o->addColumn("0", "Country", "string"); $o->addColumn("1", "Sales", "number"); $o->addColumn("2", "Expenses", "number"); $o->addNewRow(); $o->addStringCellToRow("US"); $o->addNumberCellToRow(10000); $o->addNumberCellToRow(8000); $o->addNewRow(); $o->addStringCellToRow("CA"); $o->addNumberCellToRow(-7000); $o->addNumberCellToRow(5000); $o->addNewRow(); $o->addStringCellToRow("CN"); $o->addNumberCellToRow(8000); $o->addNumberCellToRow(12000); $o->addNewRow();
<?php include_once 'Google.merge.v_1_0.php'; $o = new Google_Data_Base(); $o->addColumn("0", "year", "string"); $o->addColumn("1", "Sales", "number"); $o->addColumn("2", "Expenses", "string"); $o->addNewRow(); $o->addStringCellToRow("2004"); $o->addNumberCellToRow(1000); $o->addNumberCellToRow(400); $o->addNewRow(); $o->addStringCellToRow("2005"); $o->addNumberCellToRow(1150); $o->addNumberCellToRow(450); $o->addNewRow(); $o->addStringCellToRow("2006"); $o->addNumberCellToRow(660); $o->addNumberCellToRow(1122); $o->addNewRow(); $o->addStringCellToRow("2007"); $o->addNumberCellToRow(855); $o->addNumberCellToRow(900); $o->addNewRow(); $o->addStringCellToRow("2008"); $o->addNumberCellToRow(545); $o->addNumberCellToRow(827); $c = new Google_Config("AreaChart", "My Title"); $c->setProperty("width", 300)->setProperty("height", 200); //$c->setIsStacked(true); $c->setPointSize(8);