exp goals in grafic

This commit is contained in:
salam committed 2026-06-14 16:51:01 +02:00
1 parent f37c00ea0b
commit d8ef090721
2 files changed
+49 -1

No files matched your search

+1 -1
View File
@@ -14,7 +14,7 @@
## 1) GRAFICI: visualizzare di default solo un grafico, relativo a IN FAVOUR per Events o HOMETEAM per Performaces
## 2) CALCOLO DELLA MEDIANA: cambiamolo in questo modo: ordiniamo tutti i valori dal minore al maggiore, se il totale dati è dispari prendiamo il valore a metà dell'elenco, se è pari facciamo la media dei due valori a metà dell'elenco
## 3) RIEPILOGO DATI: sostituire HOME con IN FAVOUR e AWAY con AGAINST
4) CALCOLO SBAGLIATO di CARDS AWAY di qualsiasi squadra. Viene visualizzato sempre 0 ma i dati sono presenti nel DB
## 4) CALCOLO SBAGLIATO di CARDS AWAY di qualsiasi squadra. Viene visualizzato sempre 0 ma i dati sono presenti nel DB
5) Aggiungere, nel caso l'operatore scelga di visualizzare i dati statistici GOALS a livello di EVENTS, anche il grafico relativo alle Aspettative Goals Fatte e Subite che possiamo denominare EG-In Favour e EG-Against
6) Aggiungere nel Grafico Performance anche i dati della partita (Data / Home / Away / Risultato) come per gli altri grafici
7) Il Grafico della Moving Average per Events Performance secondo me è sbagliato quindi probabilmnete c'è un errore nel calcolo della Moving Average
+48
View File
@@ -150,6 +150,8 @@ class LoadEvents
$dataset_home = [];
$dataset_away = [];
$dataset_exp_home = [];
$dataset_exp_away = [];
$results_per_event = [];
$playing_date = [];
$labels = [];
@@ -158,6 +160,8 @@ class LoadEvents
foreach ($res as $value) {
// dd($value);
$labels[] = round($value['starttime']->diffInDays(Carbon::now()));
$playing_date[] = $value['starttime']->format('d. F Y H:i');
@@ -183,6 +187,8 @@ class LoadEvents
case 'gls':
$val_home = (int) $value['gls_h'];
$val_away = (int) $value['gls_a'];
$dataset_exp_home[] = (float) round($value['exp_home'], 1);
$dataset_exp_away[] = (float) round($value['exp_away'], 1);
break;
case 'crn':
$val_home = (int) $value['crn_h'];
@@ -229,6 +235,8 @@ class LoadEvents
case 'gls':
$val_home = (int) $value['gls_a'];
$val_away = (int) $value['gls_h'];
$dataset_exp_home[] = (float) round($value['exp_away'], 1);
$dataset_exp_away[] = (float) round($value['exp_home'], 1);
break;
case 'crn':
$val_home = (int) $value['crn_a'];
@@ -285,9 +293,13 @@ class LoadEvents
if ($team_id == $value['home_id']) {
$val_home = (int) $value['gls_h'];
$val_away = (int) $value['gls_a'];
$dataset_exp_home[] = (float) round($value['exp_home'], 1);
$dataset_exp_away[] = (float) round($value['exp_away'], 1);
} else {
$val_home = (int) $value['gls_a'];
$val_away = (int) $value['gls_h'];
$dataset_exp_home[] = (float) round($value['exp_away'], 1);
$dataset_exp_away[] = (float) round($value['exp_home'], 1);
}
break;
case 'crn':
@@ -403,6 +415,42 @@ class LoadEvents
'away_team' => $away_team,
'similar_past_matches' => $similar_past_matches,
];
if ($dataset_exp_home) {
$data['datasets'][] = [
'label' => 'Goals ' . $label1,
'events' => $events,
'playing_date' => $playing_date,
'results_per_event' => $results_per_event,
'data' => $dataset_exp_home,
'tension' => 0.5,
'borderColor' => '#c70036',
'backgroundColor' => '#c70036',
'pointStyle' => $hasdots,
'hidden' => true,
'fill' => [
'target' => 1,
'above' => '#fb2c3680',
'below' => '#fdc70080',
],
];
$data['datasets'][] = [
'label' => 'Goals ' . $label2,
'events' => $events,
'playing_date' => $playing_date,
'results_per_event' => $results_per_event,
'data' => $dataset_exp_away,
'tension' => 0.5,
'borderColor' => '#e17100',
'backgroundColor' => '#e17100',
'pointStyle' => $hasdots,
'hidden' => true,
'fill' => [
'target' => 1,
'above' => '#fb2c3680',
'below' => '#fdc70080',
],
];
}
self::$last_query = $data;