PHP code example of laravel-enso / charts

1. Go to this page and download the library: Download laravel-enso/charts 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/ */

    

laravel-enso / charts example snippets


use LaravelEnso\Charts\Factories\Bar;

$chart = (new Bar())
    ->title('Quarterly revenue')
    ->labels(['Q1', 'Q2', 'Q3', 'Q4'])
    ->datasets([
        'Revenue' => [12000, 18000, 15000, 22000],
        'Forecast' => [10000, 16000, 17000, 21000],
    ])
    ->gridlines()
    ->shortNumbers()
    ->get();

use LaravelEnso\Charts\Factories\Line;

$chart = (new Line())
    ->title('Users by month')
    ->labels(['Jan', 'Feb', 'Mar'])
    ->datasets([
        'Users' => [20, 40, 35],
    ])
    ->fill()
    ->get();

use LaravelEnso\Charts\Factories\Bubble;

$chart = (new Bubble())
    ->title('Portfolio risk')
    ->labels(['Low risk', 'High risk'])
    ->datasets([
        [
            [12, 4, 10],
            [18, 8, 25],
        ],
        [
            [9, 6, 15],
            [15, 12, 20],
        ],
    ])
    ->get();
bash
php artisan vendor:publish --tag=charts-config
bash
php artisan vendor:publish --tag=enso-config