https://github.com/gfazioli/laravel-morris-php
Laravel Service provider for Morris PHP
https://github.com/gfazioli/laravel-morris-php
facade laravel laravel-5-package laravel-morris-php laravel-packages morris php php-7
Last synced: 6 months ago
JSON representation
Laravel Service provider for Morris PHP
- Host: GitHub
- URL: https://github.com/gfazioli/laravel-morris-php
- Owner: gfazioli
- License: bsd-2-clause
- Created: 2016-10-19T08:20:21.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2017-03-06T12:48:47.000Z (over 8 years ago)
- Last Synced: 2025-04-09T20:03:52.034Z (6 months ago)
- Topics: facade, laravel, laravel-5-package, laravel-morris-php, laravel-packages, morris, php, php-7
- Language: PHP
- Homepage: http://gfazioli.github.io/Laravel-Morris-PHP/
- Size: 45.9 KB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# Laravel Morris PHP
[](https://packagist.org/packages/gfazioli/laravel-morris-php)
[](https://packagist.org/packages/gfazioli/laravel-morris-php)
[](https://packagist.org/packages/gfazioli/laravel-morris-php)
[](https://packagist.org/packages/gfazioli/laravel-morris-php)Laravel Morris PHP is the version for Laravel of [MorrisPHP](https://github.com/gfazioli/morris-php)
With this Service Provider, you can draw amazing char by usign [Morris.js]( http://morrisjs.github.io/morris.js/ ).## Requirements
* PHP 5.5.9 or greater
* Laravel 5.4 or greater## Installation
composer require gfazioli/laravel-morris-php
## Laravel
We include service providers and a facade for easy integration and a nice syntax for Laravel.
Firstly, add the `gfazioli\Morris\MorrisServiceProvider` provider to the providers array in `config/app.php`
```php
'providers' => [
...
gfazioli\Morris\MorrisServiceProvider::class,
],
```and then add the facade to your `aliases` array
```php
'aliases' => [
...
'Morris' => gfazioli\Morris\Facades\MorrisFacade::class,
],
```## HTML
Remember to include the following Javascript and styles before use Morris.
```html
```## Examples
```html
xkey( [ 'y' ] )
->ykeys( [ 'a', 'b' ] )
->labels( [ 'Series A', 'Series B' ] )
->hoverCallback( 'function(index, options, content){var row = options.data[index];return "sin(" + row.x + ") = " + row.y;}' )
->data( [
[ "y" => '2006', "a" => 100, "b" => 90 ],
[ "y" => '2007', "a" => 75, "b" => 65 ],
[ "y" => '2008', "a" => 50, "b" => 40 ],
[ "y" => '2009', "a" => 75, "b" => 65 ],
[ "y" => '2010', "a" => 50, "b" => 40 ],
[ "y" => '2011', "a" => 75, "b" => 65 ],
[ "y" => '2012', "a" => 100, "b" => 90 ]
] );```
```html
xkey( [ 'y' ] )
->ykeys( [ 'a', 'b' ] )
->labels( [ 'Series A', 'Series B' ] )
->data( [
[ "y" => '2006', "a" => 100, "b" => 90 ],
[ "y" => '2007', "a" => 75, "b" => 65 ],
[ "y" => '2008', "a" => 50, "b" => 40 ],
[ "y" => '2009', "a" => 75, "b" => 65 ],
[ "y" => '2010', "a" => 50, "b" => 40 ],
[ "y" => '2011', "a" => 75, "b" => 65 ],
[ "y" => '2012', "a" => 100, "b" => 90 ]
] );```
```html
data( [
[ "label" => "Download Sales", "value" => 12 ],
[ "label" => "In-Store Sales", "value" => 30 ],
[ "label" => "Mail-Order Sales", "value" => 20 ]
] );```
```html
xkey( [ 'date' ] )
->ykeys( [ 'value' ] )
->labels( [ 'Money' ] )
->data( [
[ 'date' => '2010', 'value' => 88 ],
[ 'date' => '2011', 'value' => 18 ],
[ 'date' => '2012', 'value' => 28 ],
[ 'date' => '2013', 'value' => 48 ],
] );```