public function computeScale($XMin, $XMax, $MaxDivs, array $Factors, $AxisID = 0)
    {
        /* Compute each factors */
        $Results = [];
        foreach ($Factors as $Key => $Factor) {
            $Results[$Factor] = $this->processScale($XMin, $XMax, $MaxDivs, [$Factor], $AxisID);
        }
        /* Remove scales that are creating to much decimals */
        $GoodScaleFactors = [];
        foreach ($Results as $Key => $Result) {
            $Decimals = preg_split("/\./", $Result["RowHeight"]);
            if ((!isset($Decimals[1])) || (strlen($Decimals[1]) < 6)) {
                $GoodScaleFactors[] = $Key;
            }
        }

        /* Found no correct scale, shame,... returns the 1st one as default */
        if (!count($GoodScaleFactors)) {
            return $Results[$Factors[0]];
        }

        /* Find the factor that cause the maximum number of Rows */
        $MaxRows = 0;
        $BestFactor = 0;
        foreach ($GoodScaleFactors as $Key => $Factor) {
            if ($Results[$Factor]["Rows"] > $MaxRows) {
                $MaxRows = $Results[$Factor]["Rows"];
                $BestFactor = $Factor;
            }
        }

        /* Return the best visual scale */
        return $Results[$BestFactor];
    }
public function computeScale($XMin, $XMax, $MaxDivs, array $Factors, $AxisID = 0)
    {
        /* Compute each factors */
        $Results = [];
        foreach ($Factors as $Key => $Factor) {
            $Results[$Factor] = $this->processScale($XMin, $XMax, $MaxDivs, [$Factor], $AxisID);
        }
        /* Remove scales that are creating to much decimals */
        $GoodScaleFactors = [];
        foreach ($Results as $Key => $Result) {
            $Decimals = preg_split("/\./", $Result["RowHeight"]);
            if ((!isset($Decimals[1])) || (strlen($Decimals[1]) < 6)) {
                $GoodScaleFactors[] = $Key;
            }
        }

        /* Found no correct scale, shame,... returns the 1st one as default */
        if (!count($GoodScaleFactors)) {
            return $Results[$Factors[0]];
        }

        /* Find the factor that cause the maximum number of Rows */
        $MaxRows = 0;
        $BestFactor = 0;
        foreach ($GoodScaleFactors as $Key => $Factor) {
            if ($Results[$Factor]["Rows"] > $MaxRows) {
                $MaxRows = $Results[$Factor]["Rows"];
                $BestFactor = $Factor;
            }
        }

        /* Return the best visual scale */
        return $Results[$BestFactor];
    }
public function computeScale ( $ XMin , $ XMax , $ MaxDivs , array $ Factors , $ AxisID = 0 ) { /* Compute each factors */ $ Results = [ ] ; foreach ( $ Factors as $ Key => $ Factor ) { $ Results [ $ Factor ] = $ this -> processScale ( $ XMin , $ XMax , $ MaxDivs , [ $ Factor ] , $ AxisID ) ; } /* Remove scales that are creating to much decimals */ $ GoodScaleFactors = [ ] ; foreach ( $ Results as $ Key => $ Result ) { $ Decimals = preg_split ( "/\./" , $ Result [ "RowHeight" ] ) ; if ( ( ! isset ( $ Decimals [ 1 ] ) ) || ( strlen ( $ Decimals [ 1 ] ) < 6 ) ) { $ GoodScaleFactors [ ] = $ Key ; } } /* Found no correct scale, shame,... returns the 1st one as default */ if ( ! count ( $ GoodScaleFactors ) ) { return $ Results [ $ Factors [ 0 ] ] ; } /* Find the factor that cause the maximum number of Rows */ $ MaxRows = 0 ; $ BestFactor = 0 ; foreach ( $ GoodScaleFactors as $ Key => $ Factor ) { if ( $ Results [ $ Factor ] [ "Rows" ] > $ MaxRows ) { $ MaxRows = $ Results [ $ Factor ] [ "Rows" ] ; $ BestFactor = $ Factor ; } } /* Return the best visual scale */ return $ Results [ $ BestFactor ] ; }
Compute the scale, check for the best visual factors
@param int $XMin
@param int $XMax
@param int $MaxDivs
@param array $Factors
@param int $AxisID
@return mixed
Compute the scale check for the best visual factors