gufy / google-charts
Requires
- php: >=5.4.0
- illuminate/support: 4.2.*
Requires (Dev)
- orchestra/testbench: ~2.2
- satooshi/php-coveralls: dev-master
This package is auto-updated.
Last update: 2024-11-13 18:34:18 UTC
README
This package will give you an easy way to create a chart with Google Charts.
Installation
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
Configuration
Registering the Package
register this service provider at the bottom of the $providers array: app.php
'Gufy\GoogleCharts\GoogleChartsServiceProvider'
Usage
Chart Class in this package
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.
Basic usage
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
Contribution Guide
Just do as usual, fork and create your own code. And then pull request.