mhapach / amcharts
am charts laravel php library
Installs: 12
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
Language:Blade
Requires
- php: >=7.2
README
This package is a Laravel (7.0+) wrapper which helps you create AmCharts charts
Installation
Add AmCharts lib to your project via Composer
$ composer require mhapach/amcharts
Configuration
Copy views to your project:
php artisan vendor:publish --provider="mhapach\AmCharts\Providers\AmChartsProvider"
Usage
In your controller create instance of AmChart with name of chart that corresponds to directory structure in your resource/views/vendor/amcharts
$chart = new AmChart('xy.column_stacked');
$chart->setLibraries([
'https://cdn.amcharts.com/lib/5/index.js',
"https://cdn.amcharts.com/lib/5/xy.js",
'https://cdn.amcharts.com/lib/5/themes/Animated.js',
'https://cdn.amcharts.com/lib/5/themes/Responsive.js',
'https://cdn.amcharts.com/lib/5/locales/ru_RU.js',
]);
$chart->setData(
[[
"year"=> "2021",
"europe"=> 2.5,
"namerica"=> 2.5,
"asia"=> 2.1,
"lamerica"=> 1,
"meast"=> 0.8,
"africa"=> 0.4
], [
"year"=> "2022",
"europe"=> 2.6,
"namerica"=> 2.7,
"asia"=> 2.2,
"lamerica"=> 0.5,
"meast"=> 0.4,
"africa"=> 0.3
], [
"year"=> "2023",
"europe"=> 2.8,
"namerica"=> 2.9,
"asia"=> 2.4,
"lamerica"=> 0.3,
"meast"=> 0.9,
"africa"=> 0.5
]]
);
print $chart->render();
Change log
Please see the changelog for more information on what has changed recently.
Contributing
Please see contributing.md for details and a todolist.
Security
If you discover any security related issues, please email author email instead of using the issue tracker.
Credits
License
license. Please see the license file for more information.