public static function PHPExcel_Calculation_Statistical::GROWTH in Loft Data Grids 7.2
Same name and namespace in other branches
- 6.2 vendor/phpoffice/phpexcel/Classes/PHPExcel/Calculation/Statistical.php \PHPExcel_Calculation_Statistical::GROWTH()
* GROWTH * * Returns values along a predicted emponential trend * *
Parameters
array of mixed Data Series Y: * @param array of mixed Data Series X * @param array of mixed Values of X for which we want to find Y * @param boolean A logical value specifying whether to force the intersect to equal 0. * @return array of float
File
- vendor/
phpoffice/ phpexcel/ Classes/ PHPExcel/ Calculation/ Statistical.php, line 1734
Class
- PHPExcel_Calculation_Statistical
- PHPExcel_Calculation_Statistical
Code
public static function GROWTH($yValues, $xValues = array(), $newValues = array(), $const = True) {
$yValues = PHPExcel_Calculation_Functions::flattenArray($yValues);
$xValues = PHPExcel_Calculation_Functions::flattenArray($xValues);
$newValues = PHPExcel_Calculation_Functions::flattenArray($newValues);
$const = is_null($const) ? True : (bool) PHPExcel_Calculation_Functions::flattenSingleValue($const);
$bestFitExponential = trendClass::calculate(trendClass::TREND_EXPONENTIAL, $yValues, $xValues, $const);
if (empty($newValues)) {
$newValues = $bestFitExponential
->getXValues();
}
$returnArray = array();
foreach ($newValues as $xValue) {
$returnArray[0][] = $bestFitExponential
->getValueOfYForX($xValue);
}
return $returnArray;
}