You are here

function PHPExcel_Polynomial_Best_Fit::__construct in Loft Data Grids 6.2

Same name and namespace in other branches
  1. 7.2 vendor/phpoffice/phpexcel/Classes/PHPExcel/Shared/trend/polynomialBestFitClass.php \PHPExcel_Polynomial_Best_Fit::__construct()

* Define the regression and calculate the goodness of fit for a set of X and Y data values * *

Parameters

int $order Order of Polynomial for this regression: * @param float[] $yValues The set of Y-values for this regression * @param float[] $xValues The set of X-values for this regression * @param boolean $const

Overrides PHPExcel_Best_Fit::__construct

File

vendor/phpoffice/phpexcel/Classes/PHPExcel/Shared/trend/polynomialBestFitClass.php, line 209

Class

PHPExcel_Polynomial_Best_Fit
PHPExcel_Polynomial_Best_Fit

Code

function __construct($order, $yValues, $xValues = array(), $const = True) {
  if (parent::__construct($yValues, $xValues) !== False) {
    if ($order < $this->_valueCount) {
      $this->_bestFitType .= '_' . $order;
      $this->_order = $order;
      $this
        ->_polynomial_regression($order, $yValues, $xValues, $const);
      if ($this
        ->getGoodnessOfFit() < 0.0 || $this
        ->getGoodnessOfFit() > 1.0) {
        $this->_error = True;
      }
    }
    else {
      $this->_error = True;
    }
  }
}