PHP code example of rcousens / amcharts-bundle

1. Go to this page and download the library: Download rcousens/amcharts-bundle library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

rcousens / amcharts-bundle example snippets

 php
       
       ...
       public function registerBundles()
       {
           $bundles = array(
               ...
               new RC\AmChartsBundle\RCAmChartsBundle(),
               ...
           );
       ...
   
 php
    
    use RC\AmChartsBundle\AmCharts\AmPieChart;

    // ...
    public function chartAction()
    {
        // Chart
        $pieChart = new \RC\AmChartsBundle\AmCharts\AmPieChart();
        
        $pieChart->renderTo('piechart');
        $pieChart->setTitleField('number');
        $pieChart->setValueField('column-1');
        $pieChart->addData(array('number' => '1', 'column-1' => 10));
        $pieChart->addData(array('number' => '2', 'column-1' => 40));
        $pieChart->addData(array('number' => '3', 'column-1' => 30));

        return $this->render('::template.html.twig', array(
            'chart' => $chart
        ));
    }