PHP code example of gebrail / charts-reports

1. Go to this page and download the library: Download gebrail/charts-reports library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

gebrail / charts-reports example snippets



$data = User::select(array('name', 'sales'))->take(3)->get();

 $options = [
              'chart_name' => 'Donut Chart',
              'chart_type' => 'Pie & Donut',    
              'chart_subtype' => 'Donut',
              'field_category' => 'name',
              'field_value' => 'sales',
              'chart_data'=> $data,
           ];
$chart = new ChartReport($options);

return view('graph', compact('chart'));