statistico players wip
This commit is contained in:
1 parent
314ab7885b
commit
5010e7ac02
12 files changed
+75
-54
No files matched your search
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Widgets\Data;
|
||||
|
||||
class HelperMoveingAverage
|
||||
{
|
||||
public static function get(&$data)
|
||||
{
|
||||
|
||||
$arr = $data['datasets'][0]['data'];
|
||||
|
||||
$new = [];
|
||||
$last = count($arr);
|
||||
foreach ($arr as $key => $value) {
|
||||
switch ($key) {
|
||||
case 0:
|
||||
$new[] = $value;
|
||||
break;
|
||||
case $last:
|
||||
$new[] = $arr[$last];
|
||||
break;
|
||||
default:
|
||||
$before = $key--;
|
||||
$after = $key++;
|
||||
$new[] = ($arr[$before] + $value + $arr[$after]) / 3;
|
||||
break;
|
||||
}
|
||||
}
|
||||
$data['datasets'][0]['borderColor'] = '#00a63e';
|
||||
$data['datasets'][0]['data'] = $new;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user