kalitics / amchart-bundle
Create easy am charts (WIP)
Installs: 95
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Forks: 0
Type:symfony-bundle
pkg:composer/kalitics/amchart-bundle
Requires
- php: ^7.2
This package is auto-updated.
Last update: 2025-10-26 21:33:13 UTC
README
symfony-amcharts
AmCharts for symfony Build your chart with twig and php only! You can create reusable code.
How to get started
Installation
- Add the following to your - composer.jsonfile- "require": { ... "kalamurda/amcharts-bundle": "dev-master@dev" ... }
- Run - php composer.phar update "kalamurda/amcharts-bundle"
- Register the bundle in your - app/AppKernel.php:- <?php ... public function registerBundles() { $bundles = array( ... new \IK\AmChartsBundle\IKAmChartsBundle(), ... ); ...
Usage
- phpController - $preperadArr = [ [ 'column1' => 5, 'column2' => 9, 'date' => '2017-06-01' ],[ 'column1' => 5, 'column2' => 9, 'date' => '2017-06-02' ],[ 'column1' => 5, 'column2' => 9, 'date' => '2017-06-03' ], ...... ]; $dataProvider = new DataProvider($preperadArr); $chart = new CombinedBulletColumnLineChart(); $chart->setTheme('dark'); $chart->setDataProvider($dataProvider); return $this->render('default/index.html.twig', [ 'chart' => $chart, 'style' => $chart->getStyle(), 'scripts' => $chart->getLibraryScripts() ]);
- twig index.html.twig - ... <!-- Styles --> <style> {{ style }} </style> <!-- Load jQuery from Google's CDN if needed --> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js" type="text/javascript"></script> {{ scripts.standart|raw }} {{ scripts.theme|raw }} <script type="text/javascript"> {{ amchart(chart) }} </script> <div id="chartdiv"></div> ...
for more details look examples in root directory. You can override any property.
