Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Standalone library for easy chart generating using Google Chart API
branch: master

Merge pull request #5 from rdohms/master

Adding gradient support in chart colors
latest commit bd91407781
martinsik authored

GoogleChartGenerator v0.1.4 - dev

Standalone library for easy implementation of Google Chart API.

How does it look like


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


Download the Source Code

From GitHub repository

git clone _your_project_lib/GoogleChartGenerator

or download and unzip latest version from:

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="|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 -->|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.