A super simple Bundle that facilitate the usage of Google Chart Tool, Google Chart Image API and Google Infographics.

Installs: 28 383

Dependents: 1

Stars: 21

Watchers: 3

Forks: 9

Language: PHP

v1.1 2013-11-09 01:15 UTC


This is a super simple Bundle that facilitate the usage of Google Chart Tool, Google Chart Image API and Google Infographics.

It allows to render:

  • QRCode
  • Pie Chart (3 ways: canvas or svg, simple image from url, simple 3d image from url)
  • Column Chart
  • Bar Chart
  • Area Chart
  • scatter Chart
  • Combo Chart
  • Table
  • Gauge
  • Candlestick Chart
  • Map tree
  • Dynamic Icons

Make sure you read the Chart Image terms and Chart tool terms before using that bundle.

It also contains some Twig extension that facilitates the integration.


How to install it?

Thanks to AaronDDM, you can use composer to instlall the bundle. Or you can use the following method:

  1. Add this bundle to your vendor/ dir:

    • Using the vendors script.

      Add the following lines in your deps file:


      Run the vendors script:

      ./bin/vendors install
    • Using git submodules.

      $ git submodule add git:// vendor/bundles/SaadTazi/GChartBundle
  2. Add the SaadTazi namespace to your autoloader:

          // app/autoload.php
                'SaadTazi' => __DIR__.'/../vendor/bundles',
                // your other namespaces
  1. Add this bundle to your application's kernel:
          // app/ApplicationKernel.php
          public function registerBundles()
              return array(
                  // ...
                  new SaadTazi\GChartBundle\SaadTaziGChartBundle(),
                  // ...

Optional: If you want to see the demo page, add the following to your routing.yml (requires Twig):

        resource: "@SaadTaziGChartBundle/Resources/config/routing.yml"
        type:     yaml
        prefix:   /gchart

Then you should be able to go to

Don't forget to include the required javascript in your layout, for example:

        <script type="text/javascript">
            // adds the package you need
            google.load("visualization", "1", {packages:["corechart", 'table', 'gauge']});

How to use it?

Mmm, please check the Controller\DemoController to see how to build DataTable, and Resources\views\Demo\demo.html.twig


I implemented almost all the corechart chart types from the Google Chart Tool. But I only implemented 3 Google Chart Image types, because (they are ugly and) almost all of them can be built using the Google Chart Tool. From the Visualization, I only implemented the marker.

Ohh, please feel free to fork, add to it and send me pull requests!

Note: You don't have to use the Twig functions: you can use the php classes (in DataTable and or in Chart). But you will probably find it a little bit "painful".



  • added composer support (thanks to AaronDDM)


  • removed jQuery dependency (and div output - needs to be done "manually" now... Provides more control)


  • zero value bug fix


  • Added DataTable::toStrictArray() that checks array keys (ticket #1)


  • Initial commit