dev-master
9999999-dev http://www.pchart.netPHP class oriented framework designed to create charts
GPL-3.0+
The Requires
- php >=5.3.3
PHP class oriented framework designed to create charts
The pChart Bundle for Symfony 2.x gives you the possibility to use the pChart library for all your charting needs., (*1)
This is an initial release and supports the rendering of all chart types. Small modification has been made to the latest release of the pChart library, since it didn't play very nicely together with Symfony 2.x and PHP5.3. pChart caching is not tested at this point., (*2)
This Bundle can be downloaded from https://github.com/rbakels/pChartBundle , but you already knew that., (*3)
See the LICENSE file included with this bundle., (*4)
Robin Bakels (robin@xlab.nl). Software Engineer for the Dutch company Xlab B.V.. See: http://www.xlab.nl/ for more information, (*5)
Installation is quick and easy, 2 steps process:, (*6)
Add the following dependency to your composer.json file: ``` json { "require": { "_some_packages": "...",, (*7)
"stocarul/pchart-bundle": "dev-master" }
}, (*8)
### Step 2: Enable the bundle Finally, enable the bundle in the kernel: ``` php <?php // app/AppKernel.php public function registerBundles() { $bundles = array( // ... new Xlab\pChartBundle\XlabpChartBundle(), ); }
Optionally, you can add the following to your routing.yml:, (*9)
pChart: resource: "@XlabpChartBundle/Resources/config/routing_pChart.yml" prefix: /pChart
This gives you the possibility to a small live preview of some examples, originally released with the pChart source. The list of examples, after inclusion of the routing_pChart.yml file gives you access to the following URL:, (*10)
http://<your_hostname>/pChart/index
There are probably more then one way to use this. Currently, I'm quite fond of generating the chart image inside a Controller action and calling this method from your Twig template file within an tag., (*11)
Example:, (*12)
<?php namespace Xlab\pChartBundle\Controller; use Xlab\pChartBundle\pData; use Xlab\pChartBundle\pDraw; use Xlab\pChartBundle\pPie; use Xlab\pChartBundle\pImage; use Xlab\pChartBundle\pBarcode39; use Xlab\pChartBundle\pBarcode128; use Symfony\Bundle\FrameworkBundle\Controller\Controller; use Symfony\Component\HttpFoundation\Response; class ExamplesController extends Controller { public function exampleAction() { $response = new Response(); $response->headers->set('Content-Type', 'image/png'); /* pChart stuff goes here */ ... /* Capture output and return the response */ ob_start(); $chart->autoOutput(); $response->setContent(ob_get_clean()); return $respone; } }
In the above example, the $chart variable is an instance of a pImage class., (*13)
See also: Xlab/pChartBundle/Controller/ExamplesController.php, (*14)
16 March 2012:, (*15)
PHP class oriented framework designed to create charts
GPL-3.0+