Login   Register  
PHP Classes
elePHPant
Icontem

File: demos/007.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  >  d3Google  >  demos/007.php  >  Download  
File: demos/007.php
Role: Example script
Content type: text/plain
Description: intensity map
Class: d3Google
Generate JavaScript to show Google charts and maps
Author: By
Last change:
Date: 1 year ago
Size: 1,754 bytes
 

Contents

Class file image Download
<?php 

// @see http://code.google.com/apis/ajax/playground/?type=visualization#intensity_map


include_once '../d3.classes.inc.php';
include_once 
'../google.classes.inc.php';
include_once 
'../element.php';

$data =  array(
    array(
'US'10000 8000),
      array(
'CA'70005000),
      array(
'CN'800012000),
      array(
'GB'700015000)
);

$id 'intensity_map';

$html E("html");
$head $html->head();
$body $html->body();

$dt google()->visualization->DataTable()->createVar("dt"true);


$head->script()->addAttribute("src""//www.google.com/jsapi");
$head->script()->add(google(true)->load("visualization""1"obj(array("packages"=>array('table''gauge''intensitymap''corechart')))));

stack()->add($dt);
stack()->add(google(true$dt->getVar())->addColumn("string""Country"));
stack()->add(google(true$dt->getVar())->addColumn("number""Sales"));
stack()->add(google(true$dt->getVar())->addColumn("number""Expenses"));

stack()->add(google(true$dt->getVar())->addRows(count($data)));

foreach(
$data as $index => $row) {
    
stack()->add(google(true$dt->getVar())->setCell($index0$row[0]));
    
stack()->add(google(true$dt->getVar())->setCell($index1$row[1]));
    
stack()->add(google(true$dt->getVar())->setCell($index2$row[2]));
}

$imap google()->visualization->IntensityMap(document()->getElementById($id))->createVar("imap"true);
stack()->add($imap);
stack()->add(google(true$imap->getVar())->draw($dt->getVar()));

$f func()->name("drawIntensityMap")->add(stack());
$head->script()->add($f);
$head->script()->add(google(true)->setOnLoadCallback($f->getVar("drawIntensityMap")->getVar()));

$body->toBody("div", array("id" => $id));



echo 
$html;