PHP Classes

File: sample_table_arrow.php

Recommend this page to a friend!
  Classes of Tom Schaefer   QGoogleVisualizationAPI 2009   sample_table_arrow.php   Download  
File: sample_table_arrow.php
Role: Example script
Content type: text/plain
Description: Sample Table Arrow Format
Class: QGoogleVisualizationAPI 2009
Generate charts with Google Visualization API
Author: By
Last change:
Date: 14 years ago
Size: 1,015 bytes
 

Contents

Class file image Download
<?php

include_once 'Google.merge.v_1_0.php';


// main
$v = new Google_Visualization("Table_Format");

// config
$c = new Google_Config("Table");
$c->setProperty("allowHtml", true);

// format
$f = Google_Format::factory("Arrow");
$f->format("data",1);

$c->setProperty("showRowNumber", true);

// data
$o = Google_Data::getInstance()->getDataObject();

$o->addColumn("0","Department","string");
$o->addColumn("1","Revenues Change","number");


$o->addNewRow();
$o->addStringCellToRow("Shoes");
$o->addNumberCellToRow(-5.4);

$o->addNewRow();
$o->addStringCellToRow("Sports");
$o->addNumberCellToRow(12.5);

$o->addNewRow();
$o->addStringCellToRow("Toys");
$o->addNumberCellToRow(21.2);

$o->addNewRow();
$o->addStringCellToRow("Food");
$o->addNumberCellToRow(24.2);


$v->setConfig($c);
$v->setData($o);
$v->setFormat($f);

?><html>
<head>
<?php
   
echo $v->render();
?>
</head>
<body>
    <div id="selectedValue"></div>
    <div id="chart"></div>
</body>
</html>