public function scaleFormat($Value, $Mode = null, $Format = null, $Unit = null)
    {
        if ($Value == VOID) {
            return "";
        }

        if ($Mode == AXIS_FORMAT_TRAFFIC) {
            if ($Value == 0) {
                return "0B";
            }
            $Units = ["B", "KB", "MB", "GB", "TB", "PB"];
            $Sign = "";
            if ($Value < 0) {
                $Value = abs($Value);
                $Sign = "-";
            }

            $Value = number_format($Value / pow(1024, ($Scale = floor(log($Value, 1024)))), 2, ",", ".");
            return $Sign . $Value . " " . $Units[$Scale];
        }

        if ($Mode == AXIS_FORMAT_CUSTOM) {
            if (is_callable($Format)) {
                return call_user_func($Format, $Value);
            }
        }

        if ($Mode == AXIS_FORMAT_DATE) {
            $Pattern = "d/m/Y";
            if ($Format !== null) {
                $Pattern = $Format;
            }

            return gmdate($Pattern, $Value);
        }

        if ($Mode == AXIS_FORMAT_TIME) {
            $Pattern = "H:i:s";
            if ($Format !== null) {
                $Pattern = $Format;
            }

            return gmdate($Pattern, $Value);
        }

        if ($Mode == AXIS_FORMAT_CURRENCY) {
            return $Format . number_format($Value, 2);
        }

        if ($Mode == AXIS_FORMAT_METRIC) {
            if (abs($Value) > 1000000000) {
                return round($Value / 1000000000, $Format) . "g" . $Unit;
            }
            if (abs($Value) > 1000000) {
                return round($Value / 1000000, $Format) . "m" . $Unit;
            } elseif (abs($Value) >= 1000) {
                return round($Value / 1000, $Format) . "k" . $Unit;
            }
        }
        return $Value . $Unit;
    }
public function scaleFormat($Value, $Mode = null, $Format = null, $Unit = null)
    {
        if ($Value == VOID) {
            return "";
        }

        if ($Mode == AXIS_FORMAT_TRAFFIC) {
            if ($Value == 0) {
                return "0B";
            }
            $Units = ["B", "KB", "MB", "GB", "TB", "PB"];
            $Sign = "";
            if ($Value < 0) {
                $Value = abs($Value);
                $Sign = "-";
            }

            $Value = number_format($Value / pow(1024, ($Scale = floor(log($Value, 1024)))), 2, ",", ".");
            return $Sign . $Value . " " . $Units[$Scale];
        }

        if ($Mode == AXIS_FORMAT_CUSTOM) {
            if (is_callable($Format)) {
                return call_user_func($Format, $Value);
            }
        }

        if ($Mode == AXIS_FORMAT_DATE) {
            $Pattern = "d/m/Y";
            if ($Format !== null) {
                $Pattern = $Format;
            }

            return gmdate($Pattern, $Value);
        }

        if ($Mode == AXIS_FORMAT_TIME) {
            $Pattern = "H:i:s";
            if ($Format !== null) {
                $Pattern = $Format;
            }

            return gmdate($Pattern, $Value);
        }

        if ($Mode == AXIS_FORMAT_CURRENCY) {
            return $Format . number_format($Value, 2);
        }

        if ($Mode == AXIS_FORMAT_METRIC) {
            if (abs($Value) > 1000000000) {
                return round($Value / 1000000000, $Format) . "g" . $Unit;
            }
            if (abs($Value) > 1000000) {
                return round($Value / 1000000, $Format) . "m" . $Unit;
            } elseif (abs($Value) >= 1000) {
                return round($Value / 1000, $Format) . "k" . $Unit;
            }
        }
        return $Value . $Unit;
    }
public function scaleFormat ( $ Value , $ Mode = null , $ Format = null , $ Unit = null ) { if ( $ Value == VOID ) { return "" ; } if ( $ Mode == AXIS_FORMAT_TRAFFIC ) { if ( $ Value == 0 ) { return "0B" ; } $ Units = [ "B" , "KB" , "MB" , "GB" , "TB" , "PB" ] ; $ Sign = "" ; if ( $ Value < 0 ) { $ Value = abs ( $ Value ) ; $ Sign = "-" ; } $ Value = number_format ( $ Value / pow ( 1024 , ( $ Scale = floor ( log ( $ Value , 1024 ) ) ) ) , 2 , "," , "." ) ; return $ Sign . $ Value . " " . $ Units [ $ Scale ] ; } if ( $ Mode == AXIS_FORMAT_CUSTOM ) { if ( is_callable ( $ Format ) ) { return call_user_func ( $ Format , $ Value ) ; } } if ( $ Mode == AXIS_FORMAT_DATE ) { $ Pattern = "d/m/Y" ; if ( $ Format !== null ) { $ Pattern = $ Format ; } return gmdate ( $ Pattern , $ Value ) ; } if ( $ Mode == AXIS_FORMAT_TIME ) { $ Pattern = "H:i:s" ; if ( $ Format !== null ) { $ Pattern = $ Format ; } return gmdate ( $ Pattern , $ Value ) ; } if ( $ Mode == AXIS_FORMAT_CURRENCY ) { return $ Format . number_format ( $ Value , 2 ) ; } if ( $ Mode == AXIS_FORMAT_METRIC ) { if ( abs ( $ Value ) > 1000000000 ) { return round ( $ Value / 1000000000 , $ Format ) . "g" . $ Unit ; } if ( abs ( $ Value ) > 1000000 ) { return round ( $ Value / 1000000 , $ Format ) . "m" . $ Unit ; } elseif ( abs ( $ Value ) >= 1000 ) { return round ( $ Value / 1000 , $ Format ) . "k" . $ Unit ; } } return $ Value . $ Unit ; }
Format the axis values
@param mixed $Value
@param int $Mode
@param array $Format
@param string $Unit
@return string
Format the axis values