59 lines
1.3 KiB
PHP
59 lines
1.3 KiB
PHP
<?php
|
|
|
|
namespace App\Filament\Widgets;
|
|
|
|
use App\Filament\Widgets\Data\HelperMoveingAverage;
|
|
use App\Filament\Widgets\Data\HelperStatisticType;
|
|
use App\Filament\Widgets\Data\LoadPlayer;
|
|
use Filament\Widgets\ChartWidget;
|
|
use Filament\Widgets\Concerns\InteractsWithPageFilters;
|
|
|
|
class ChartPlayerMoAv extends ChartWidget
|
|
{
|
|
use InteractsWithPageFilters;
|
|
|
|
protected ?string $pollingInterval = null;
|
|
|
|
protected bool $isCollapsible = true;
|
|
|
|
protected ?string $heading = 'Player';
|
|
|
|
protected ?array $options = [
|
|
'plugins' => [
|
|
'legend' => [
|
|
'display' => false,
|
|
],
|
|
],
|
|
'interaction' => [
|
|
'intersect' => false,
|
|
],
|
|
'scales' => [
|
|
'y' => [
|
|
'beginAtZero' => true,
|
|
],
|
|
],
|
|
];
|
|
|
|
protected function getData(): array
|
|
{
|
|
if ($this->filters['statistic_type'] == 'crn') {
|
|
return [];
|
|
}
|
|
|
|
$this->description = ucfirst(HelperStatisticType::get($this->filters)).' Moving Average';
|
|
|
|
$data = LoadPlayer::load($this->filters);
|
|
|
|
if ($data) {
|
|
HelperMoveingAverage::get($data);
|
|
}
|
|
|
|
return $data;
|
|
}
|
|
|
|
protected function getType(): string
|
|
{
|
|
return 'line';
|
|
}
|
|
}
|