PHP Classes

File: demos/006.php

Recommend this page to a friend!
  Packages of Tom Schaefer   d3Google   demos/006.php   Download  
File: demos/006.php
Role: Example script
Content type: text/plain
Description: add events
Class: d3Google
Generate JavaScript to show Google charts and maps
Author: By
Last change:
Date: 13 years ago
Size: 1,233 bytes
 

 

Contents

Class file image Download
<pre><?php 

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

$f0 = func();

$wrapper = google()->visualization->ChartWrapper(obj(
    array(
        "chartType" => 'ColumnChart',
        "dataTable" => array(
            array('Germany', 'USA', 'Brazil', 'Canada', 'France', 'RU'),
            array(700, 300, 400, 500, 600, 800)
        ),
        "options" => array('title' => 'Countries'),
        "containerId" => 'visualization'
    )
))->createVar("wrapper");

$f0->add($wrapper);
$f0->add( google()->visualization->events()->addListener($wrapper->getVar(), "onmouseover", google::unescape("uselessHandler")) );
$f0->add( google()->visualization->events()->addListener($wrapper->getVar(), "ready", google::unescape("ready")) );
$f0->add( google(true, $wrapper->getVar())->draw() );
$f0->add( func()->add('alert("not called")')->getVar("uselessHandler") );

$f1 = google()->visualization->events()->addListener( 
    google(false, $wrapper->getVar())->getChart(), "onmouseover", google::unescape("usefulHandler")
);

$f0->add( func()->add($f1)->getVar("onReady") );

$f0->add( func()->add('alert("Mouser over event!")')->getVar("usefulHandler") );

echo $f0->getVar("drawVisualization");