57 lines
1.2 KiB
PHP
57 lines
1.2 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 ChartMovingAveragePlayer extends ChartWidget
|
|
{
|
|
use InteractsWithPageFilters;
|
|
|
|
protected ?string $pollingInterval = null;
|
|
|
|
public ?string $header;
|
|
|
|
protected ?array $options = [
|
|
'plugins' => [
|
|
'legend' => [
|
|
'display' => false,
|
|
],
|
|
],
|
|
'interaction' => [
|
|
'intersect' => false,
|
|
],
|
|
];
|
|
|
|
public function getDescription(): ?string
|
|
{
|
|
return 'Player Moving Average';
|
|
}
|
|
|
|
protected function getData(): array
|
|
{
|
|
if ($this->filters['statistic_type'] == 'crn') {
|
|
return [];
|
|
}
|
|
|
|
$this->heading = HelperStatisticType::get($this->filters);
|
|
|
|
$data = LoadPlayer::load($this->filters);
|
|
|
|
if ($data) {
|
|
HelperMoveingAverage::get($data);
|
|
}
|
|
|
|
return $data;
|
|
}
|
|
|
|
protected function getType(): string
|
|
{
|
|
return 'line';
|
|
}
|
|
}
|