wip bug 7
This commit is contained in:
1 parent
b656d5d993
commit
e6129fbdf6
3 files changed
+6
-11
No files matched your search
@@ -16,15 +16,15 @@ class HelperMoveingAveragePerformens
|
||||
foreach ($datasets as $k => $dataset) {
|
||||
$arr = $dataset['data'];
|
||||
|
||||
self::fillHoles($arr);
|
||||
// dd($arr);
|
||||
|
||||
$new = [];
|
||||
$last = count($arr);
|
||||
foreach ($arr as $key => $value) {
|
||||
if ($key == 1 && $last > 2) {
|
||||
$new[] = round(($arr[0] + $value + $arr[2]) / 3, 1);
|
||||
$new[] = round(($arr[0] + $value + $arr[2]) / 3, 2);
|
||||
} elseif ($key > 1 && $key < $last - 1) {
|
||||
$new[] = round(($arr[$key - 1] + $value + $arr[$key + 1]) / 3, 1);
|
||||
$new[] = round(($arr[$key - 1] + $value + $arr[$key + 1]) / 3, 2);
|
||||
}
|
||||
}
|
||||
$data['datasets'][$k]['data'] = $new;
|
||||
|
||||
Reference in new issue
Block a user