2017 © Pedro Peláez
 

library gc-datatable

PHP library to generate JSON data for Google Chart Tools.

image

amnl/gc-datatable

PHP library to generate JSON data for Google Chart Tools.

  • Wednesday, September 11, 2013
  • by itavero
  • Repository
  • 1 Watchers
  • 4 Stars
  • 7,860 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 3 Versions
  • 5 % Grown

The README.md

GC DataTable

Build Status Latest Stable Version Total Downloads, (*1)

This library is meant to simplify the dynamic generation of a JSON-representation of a DataTable when using PHP. DataTables are used by the Google Visualization API / Chart Tools, see this reference on developers.google.com for more info., (*2)

Problems? Suggestions?

Create a new issue to tell me about your suggestions and/or problems. I'd love to hear your opinion!, (*3)

Example

For the time being you can have a look at "Populating Data Using Server Side Code". The code below basically replaces getData.php and sampleData.json and allows you to dynamically change the output., (*4)

<?php

/*
 * A bunch of use-statements
 * (assuming you have some kind of autoloading mechanism)
 */
use AMNL\Google\Chart\Table;
use AMNL\Google\Chart\Column;
use AMNL\Google\Chart\Row;
use AMNL\Google\Chart\Type as T;

/* The actual code */
$pizzaTable = new Table(
    new Column(new T\String(), 'Topping'),
    new Column(new T\Number(), 'Slices')
);

$pizzaTable->addRow(new Row('Mushrooms', 3));
$pizzaTable->addRow(new Row('Onions', 1));
$pizzaTable->addRow(new Row('Olives', 1));
$pizzaTable->addRow(new Row('Zucchini', 1));
$pizzaTable->addRow(new Row('Pepperoni', 2));

/* JSON Output */
header('Content-Type: application/json');
echo $pizzaTable->toJson();

The Versions

11/09 2013

dev-master

9999999-dev https://github.com/itavero/AMNL-GCDataTable

PHP library to generate JSON data for Google Chart Tools.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

json google charts chart tools

07/06 2013

v0.2.0

0.2.0.0 https://github.com/itavero/AMNL-GCDataTable

PHP library to generate JSON data for Google Chart Tools.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

json google charts chart tools

28/10 2012

v0.1.0

0.1.0.0 https://github.com/itavero/AMNL-GCDataTable

PHP library to generate JSON data for Google Chart Tools.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

json google charts chart tools