Number of days since the event

This commit is contained in:
salam committed 2026-08-04 16:54:19 +02:00
1 parent d4e5a2f181
commit c2d9b451fd
10 files changed
+25 -15

No files matched your search

+1 -1
View File
@@ -82,7 +82,7 @@ class ChartEvent extends ChartWidget
x: { x: {
title: { title: {
display: true, display: true,
text: 'Days since event' text: 'Number of days since the event'
} }
}, },
y: { y: {
+1 -1
View File
@@ -83,7 +83,7 @@ class ChartEventMoAv extends ChartWidget
x: { x: {
title: { title: {
display: true, display: true,
text: 'Days since event' text: 'Number of days since the event'
} }
}, },
y: { y: {
+1 -1
View File
@@ -69,7 +69,7 @@ class ChartEventPerf extends ChartWidget
x: { x: {
title: { title: {
display: true, display: true,
text: 'Days since event' text: 'Number of days since the event'
} }
}, },
}, },
+1 -1
View File
@@ -77,7 +77,7 @@ class ChartEventPerfMoAv extends ChartWidget
x: { x: {
title: { title: {
display: true, display: true,
text: 'Days since event' text: 'Number of days since the event'
} }
}, },
}, },
+1 -1
View File
@@ -78,7 +78,7 @@ class ChartPlayer extends ChartWidget
x: { x: {
title: { title: {
display: true, display: true,
text: 'Days since event' text: 'Number of days since the event'
} }
}, },
y: { y: {
+1 -1
View File
@@ -81,7 +81,7 @@ class ChartPlayerMoAv extends ChartWidget
x: { x: {
title: { title: {
display: true, display: true,
text: 'Days since event' text: 'Number of days since the event'
} }
}, },
y: { y: {
+1 -1
View File
@@ -75,7 +75,7 @@ class ChartPlayerPerf extends ChartWidget
x: { x: {
title: { title: {
display: true, display: true,
text: 'Days since event' text: 'Number of days since the event'
} }
}, },
y: { y: {
+1 -1
View File
@@ -79,7 +79,7 @@ class ChartPlayerPerfMoAv extends ChartWidget
x: { x: {
title: { title: {
display: true, display: true,
text: 'Days since event' text: 'Number of days since the event'
} }
}, },
y: { y: {
+16 -6
View File
@@ -2,9 +2,9 @@
namespace App\Filament\Widgets\Data; namespace App\Filament\Widgets\Data;
use Illuminate\Support\Carbon;
use App\Models\StatistikoDetail; use App\Models\StatistikoDetail;
use App\Models\StatistikoPlayer; use App\Models\StatistikoPlayer;
use Illuminate\Support\Carbon;
class LoadPlayer class LoadPlayer
{ {
@@ -50,19 +50,20 @@ class LoadPlayer
$res = StatistikoPlayer::with('event')->where('ss_player_id', (int) $ss_player_id)->get(); $res = StatistikoPlayer::with('event')->where('ss_player_id', (int) $ss_player_id)->get();
$labels = [];
$datasets = []; $tmp = [];
foreach ($res as $value) { foreach ($res as $value) {
// dd($value); // dd($value);
$val = 0; $val = 0;
$key = 0;
if (isset($value->event->starttime)) { if (isset($value->event->starttime)) {
// $labels[] = $value->event->starttime->format('d.M.y'); // $labels[] = $value->event->starttime->format('d.M.y');
$labels[] = round($value->event->starttime->diffInDays(Carbon::now())); $key = round($value->event->starttime->diffInDays(Carbon::now()));
switch ($statistic_type) { switch ($statistic_type) {
case 'gls': case 'gls':
@@ -87,15 +88,24 @@ class LoadPlayer
$val = (int) $value->shots_off_target; $val = (int) $value->shots_off_target;
break; break;
} }
$tmp[$key] = $val;
} }
$datasets[] = $val; }
ksort($tmp);
$dataset = [];
$labels = [];
foreach ($tmp as $key => $value) {
$labels[] = $key;
$dataset[] = $value;
} }
$data = [ $data = [
'datasets' => [ 'datasets' => [
[ [
'label' => ucfirst($statistic_name), 'label' => ucfirst($statistic_name),
'data' => $datasets, 'data' => $dataset,
'tension' => 0.5, 'tension' => 0.5,
'borderColor' => '#36A2EB', 'borderColor' => '#36A2EB',
'pointStyle' => $hasdots, 'pointStyle' => $hasdots,
@@ -68,7 +68,7 @@ class LoadPlayerPerformance
$dataset[] = $value; $dataset[] = $value;
} }
$labels = array_keys($dataset); // $labels = array_keys($dataset);
$data = [ $data = [
'datasets' => [ 'datasets' => [