This package will give you an easy way to create a chart with Google Charts.
Run this to install on your current project
$ composer require gufy/google-charts:dev-master
Or you can add this package to your composer.json file:
"require": {
"gufy/google-charts": "dev-master"
}
Use composer to install this package.
$ composer update
register this service provider at the bottom of the $providers array: app.php
'Gufy\GoogleCharts\GoogleChartsServiceProvider'
Here is the list of Chart you can use.
- Area Chart
- Bar Chart
- Bubble Chart
- Line Chart
It will update continuously until every chart on Google Chart API covered.
Before you go, please add this on your layouts to make sure everything is works. In this package, it doesn't include the script URL.
<script type="text/javascript" src="https://www.google.com/jsapi"></script>
Creating An Area Chart
<?php
// set some of options
$options = [
'xAxis'=>[
'title'=>'Discovery Channels'
]
];
$chart = Area::setOptions($options);
// create columns
$chart->setColumns([
'Year',
'Extinction Growth'
]);
// set some data
$chart->setData([
['2010', 15000],
['2011', 14037],
['2012', 16021],
['2013', 13520],
]);
// run this on your view
$chart->render();
For reference on Google Charts API please follow https://developers.google.com/chart
Just do as usual, fork and create your own code. And then pull request.