PHP code example of jonquihote / filament-static-chart-widgets

1. Go to this page and download the library: Download jonquihote/filament-static-chart-widgets 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/ */

    

jonquihote / filament-static-chart-widgets example snippets




namespace App\Filament\Widgets;

use JQHT\FilamentStaticChartWidgets\Widgets\PieChartWidget;
use JQHT\FilamentStaticChartWidgets\Widgets\PieChartWidget\Slice;

class CakeCompositionChart extends PieChartWidget
{
    protected function getHeading(): string
    {
        return 'Cake Composition';
    }

    protected function getSlices(): array
    {
        return [
            Slice::make('Flour', 160),
            Slice::make('Sugar', 100),
            Slice::make('Egg', 100),
            Slice::make('Butter', 40),
        ];
    }
}

protected function getSlices(): array
{
    return [
        Slice::make('Flour', 160)->color('blue'),
        Slice::make('Sugar', 100)->color('orange'),
        Slice::make('Egg', 100)->color('indigo'),
        Slice::make('Butter', 40)->color('yellow'),
    ];
}



namespace App\Filament\Widgets;

use JQHT\FilamentStaticChartWidgets\Widgets\PieChartWidget;
use JQHT\FilamentStaticChartWidgets\Widgets\PieChartWidget\Slice;

class CakeCompositionChart extends PieChartWidget
{
    public bool $showTotalLabel = true;

    public string $size = 'md';
}
bash
php artisan vendor:publish --tag="filament-static-chart-widgets-views"