diff --git a/README.md b/README.md index 7e39725..e31c60d 100644 --- a/README.md +++ b/README.md @@ -7,20 +7,24 @@ Laravel chart is a beautiful, customizable and flexible package for creating cha 1. Install the package and its dependencies using Composer: `composer require kamandlou/laravel-chart` -2. Publish package files and create tables using Artisan command: +2. Publish package files using Artisan command: `php artisan chart:install` # Usage Guide -1. Add this to your page: - - `` - -2. Use like this: - +### Add scripts to your page: +- `` +- ``` + + ``` +### Create a canvas in your page: +- `` +### You have two way to use ``` - return Chart::render('chart', [ + return Chart::chart('myChart', [ 'type' => 'bar', 'data' => [ 'labels' => ['Red', 'Blue', 'Yellow'], @@ -49,10 +53,43 @@ Laravel chart is a beautiful, customizable and flexible package for creating cha ] ] ] - ]); + ])->render('index'); ``` +### Or +``` +return Chart::id('myChart') + ->type('bar') + ->labels(['Red', 'Blue', 'Yellow']) + ->datasets([ + [ + 'label' => '# of Votes', + 'data' => [12, 19, 3], + 'backgroundColor' => [ + 'rgba(255, 99, 132, 0.2)', + 'rgba(54, 162, 235, 0.2)', + 'rgba(255, 206, 86, 0.2)', + ], + 'borderColor' => [ + 'rgba(255, 99, 132, 1)', + 'rgba(54, 162, 235, 1)', + 'rgba(255, 206, 86, 1)', + ], + 'borderWidth' => 1 + ] + ]) + ->options([ + 'scales' => [ + 'y' => [ + 'beginAtZero' => true + ] + ] + ]) + ->render('index'); +``` ### for see more option go to chart.js documention + [Chart.js Document](https://www.chartjs.org/docs/latest/getting-started/) ### note + - This package is under development