first commit
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
defined('BASEPATH') or exit('No direct script access allowed');
|
||||
|
||||
function variation($data, $i, $f, $t, &$dMin, &$dMax, &$tVar, &$tVar0)
|
||||
{
|
||||
$tVar[] = $f['cost'];
|
||||
$trend = $t[$f['time']][2];
|
||||
$delta = $f['cost'] - $trend;
|
||||
$variation = stats_variance($tVar);
|
||||
if ($delta>$dMax) $dMax = $delta;
|
||||
if ($delta<$dMin) $dMin = $delta;
|
||||
$tVar0[$f['time']] = $variation;
|
||||
|
||||
/* {
|
||||
"travel_date":"2020-05-10 14:54:04+00",
|
||||
"cost":"12",
|
||||
"location_start_lat":"1.319292",
|
||||
"location_start_lng":"103.9126091",
|
||||
"location_end_lat":"1.316269",
|
||||
"location_end_lng":"103.977615",
|
||||
"origin":"Central East - Eunos",
|
||||
"destination":"Far East - Changi",
|
||||
"c":"#5555ff"} */
|
||||
//if ($i<5) error_log(json_encode($t));
|
||||
return [$trend, $delta, $variation];
|
||||
}
|
||||
Reference in New Issue
Block a user