Files
nuhodds_fi4/app/Filament/Widgets/ChartPunctualPlayer.php
T
2026-05-27 18:14:44 +02:00

56 lines
1.2 KiB
PHP

<?php
namespace App\Filament\Widgets;
use App\Filament\Widgets\Data\HelperStatisticType;
use App\Filament\Widgets\Data\LoadPlayer;
use Filament\Widgets\ChartWidget;
use Filament\Widgets\Concerns\InteractsWithPageFilters;
class ChartPunctualPlayer extends ChartWidget
{
use InteractsWithPageFilters;
protected ?string $pollingInterval = null;
protected ?array $options = [
'plugins' => [
'legend' => [
'display' => false,
],
],
'interaction' => [
'intersect' => false,
],
'callbacks' => [
'label' => 'function(context) {
return " Count: " + context.raw;
}',
],
];
protected function getData(): array
{
if ($this->filters['statistic_type'] == 'crn') {
return [];
}
$this->heading = 'Player';
$this->description = HelperStatisticType::get($this->filters);
if (isset($data['description'])) {
$this->description .= $data['description'];
}
$data = LoadPlayer::load($this->filters);
return $data;
}
protected function getType(): string
{
return 'line';
}
}