PHP code example of akaunting / laravel-apexcharts

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

    

akaunting / laravel-apexcharts example snippets


use Akaunting\Apexcharts\Chart;

// ...

$chart = (new Chart)->setType('donut')
    ->setWidth('100%')
    ->setHeight(300)
    ->setLabels(['Sales', 'Deposit'])
    ->setDataset('Income by Category', 'donut', [1907, 1923]);

Route::get('dashboard', function () {
    $chart = (new Chart)->setType('...');

    return inertia('dashboard', [
        'chart' => $chart->toVue(),
    ]);
});
bash
php artisan vendor:publish --tag=apexcharts
blade
<!-- layout.blade.php -->

<body>
    <!-- ... -->

    @apexchartsScripts
</body>
blade
<!-- dashboard.blade.php -->

{!! $chart->container() !!}

{!! $chart->script() !!}