PHP Classes

File: sample_table_pattern.php

Recommend this page to a friend!
  Classes of Tom Schaefer   QGoogleVisualizationAPI 2009   sample_table_pattern.php   Download  
File: sample_table_pattern.php
Role: Example script
Content type: text/plain
Description: Table Pattern with DataView
Class: QGoogleVisualizationAPI 2009
Generate charts with Google Visualization API
Author: By
Last change:
Date: 15 years ago
Size: 966 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);
$c->setProperty("showRowNumber", true);

// format
$f = Google_Format::factory("Pattern");
$f->pattern('<a href="mailto:{1}">{0}</a>');
$f->format("data",array(0,1));

// data view

$d = new Google_Data_View;
$d->setColumns(array(0));

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

$o->addColumn("0","Name","string");
$o->addColumn("1","Email","string");

$o->addNewRow();
$o->addStringCellToRow("Tom");
$o->addStringCellToRow("scaphare@gmail.com");

$o->addNewRow();
$o->addStringCellToRow("Mike");
$o->addStringCellToRow("mike@gmail.com");

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

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