PHP code example of arbermustafa / filament-google-charts-widgets
1. Go to this page and download the library: Download arbermustafa/filament-google-charts-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/ */
arbermustafa / filament-google-charts-widgets example snippets
use ArberMustafa\FilamentGoogleCharts\Widgets\PieChartWidget;
class DemoPieChart extends PieChartWidget
{
protected static ?int $sort = 1;
protected static ?array $options = [
'legend' => [
'position' => 'top',
'alignment' => 'center',
],
'height' => 400,
'is3D' => false,
];
protected function getHeading(): string
{
return 'Pie chart';
}
protected function getData(): array
{
return [
['Label', 'Aggregate'],
['Col1', 7.2],
['Col2', 23.7],
['Col3', 11.1],
];
}
}
use ArberMustafa\FilamentGoogleCharts\Widgets\DonutChartWidget;
class DemoDonutChart extends DonutChartWidget
{
protected static ?string $heading = 'Donut chart';
protected static ?int $sort = 2;
protected static ?float $pieHole = 0.5;
protected static ?array $options = [
'legend' => [
'position' => 'top',
],
'height' => 400,
];
protected function getData(): array
{
return [
['Label', 'Aggregate'],
['Col1', 17.2],
['Col2', 23.7],
['Col3', 11.1],
];
}
}
protected static ?string $pollingInterval = '10s';
protected static ?string $pollingInterval = null;
protected static ?array $options = [
'legend' => [
'position' => 'bottom',
],
'height' => 300,
];
bash
php artisan vendor:publish --tag=filament-google-charts-widgets-config
bash
php artisan vendor:publish --tag=filament-google-charts-widgets-views