Login   Register  
PHP Classes
elePHPant
Icontem

File: sample_table_color_bar.php

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  >  sample_table_color_bar.php  >  Download  
File: sample_table_color_bar.php
Role: Example script
Content type: text/plain
Description: Table Colorized Bar
Class: QGoogleVisualizationAPI 2009
Generate charts with Google Visualization API
Author: By
Last change:
Date: 2009-08-30 06:29
Size: 1,266 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("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();
$o->addStringCellToRow("UK");
$o->addNumberCellToRow(7000);
$o->addNumberCellToRow(15000);


$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>