Skip to content
This repository

Standalone library for easy chart generating using Google Chart API

branch: master

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 examples
Octocat-spinner-32 src
Octocat-spinner-32 tests
Octocat-spinner-32 .gitignore
Octocat-spinner-32 LICENSE
Octocat-spinner-32 README.md
Octocat-spinner-32 phpunit.xml.dist
README.md

GoogleChartGenerator v0.1.4 - dev

Standalone library for easy implementation of Google Chart API.

How does it look like

Documentation

For deeper information about this library visit full GoogleChartGenerator documentation on my blog.

Installation

Download the Source Code

From GitHub repository git@github.com:martinsik/GoogleChartGenerator.git:

git clone git@github.com:martinsik/GoogleChartGenerator.git _your_project_lib/GoogleChartGenerator

or download and unzip latest version from:

https://github.com/martinsik/GoogleChartGenerator

Quick Tutorial

defining a line chart:

$chart = new LineChart(array('title' => 'Chart with default settings'));
$chart->addLine(new Line(array(83,32,56,38,50,65,18,50,65,54,40,100,22,4,41,7)));

rendering in a Twig view:

{# render <img> tag #}
{{ chart.render }}

{# or just get image url #}
{{ chart.renderUrl }}

or in a PHP view:

<!-- render <img> tag -->
<?php echo $chart->render(); ?>

<!-- or just get image url -->
<?php echo $chart->renderUrl(); ?>

Generated HTML output is:

<!-- render <img> tag -->
<img src="http://chart.googleapis.com/chart?cht=lxy&chs=300x200&chd=t:-1|83,32,56,38,50,65,18,50,65,54,40,100,22,4,41,7&chtt=Chart+with+default+settings&chxt=x,y&chxr=0,0,19|1,0,100&chco=ffa909&chg=25,33.33,3,3" width="300" height="200" alt="GoogleChartBundle with default settings" />

<!-- or just get image url -->
http://chart.googleapis.com/chart?cht=lxy&chs=300x200&chd=t:-1|83,32,56,38,50,65,18,50,65,54,40,100,22,4,41,7&chtt=Chart+with+default+settings&chxt=x,y&chxr=0,0,19|1,0,100&chco=ffa909&chg=25,33.33,3,3

and finally the image:

show generated chart

Something went wrong with that request. Please try again.