Prepare the scale
@param array $Format
@return null|int
@throws Exception
425690
public function drawScatterScale(array $Format = [])
    {
        $Mode = isset($Format["Mode"]) ? $Format["Mode"] : SCALE_MODE_FLOATING;
        $Floating = isset($Format["Floating"]) ? $Format["Floating"] : false;
        $XLabelsRotation = isset($Format["XLabelsRotation"]) ? $Format["XLabelsRotation"] : 90;
        $MinDivHeight = isset($Format["MinDivHeight"]) ? $Format["MinDivHeight"] : 20;
        $Factors = isset($Format["Factors"]) ? $Format["Factors"] : [1, 2, 5];
        $ManualScale = isset($Format["ManualScale"])
            ? $Format["ManualScale"] : ["0" => ["Min" => -100, "Max" => 100]]
        ;
        $XMargin = isset($Format["XMargin"]) ? $Format["XMargin"] : 0;
        $YMargin = isset($Format["YMargin"]) ? $Format["YMargin"] : 0;
        $ScaleSpacing = isset($Format["ScaleSpacing"]) ? $Format["ScaleSpacing"] : 15;
        $InnerTickWidth = isset($Format["InnerTickWidth"]) ? $Format["InnerTickWidth"] : 2;
        $OuterTickWidth = isset($Format["OuterTickWidth"]) ? $Format["OuterTickWidth"] : 2;
        $DrawXLines = isset($Format["DrawXLines"]) ? $Format["DrawXLines"] : ALL;
        $DrawYLines = isset($Format["DrawYLines"]) ? $Format["DrawYLines"] : ALL;
        $GridTicks = isset($Format["GridTicks"]) ? $Format["GridTicks"] : 4;
        $GridR = isset($Format["GridR"]) ? $Format["GridR"] : 255;
        $GridG = isset($Format["GridG"]) ? $Format["GridG"] : 255;
        $GridB = isset($Format["GridB"]) ? $Format["GridB"] : 255;
        $GridAlpha = isset($Format["GridAlpha"]) ? $Format["GridAlpha"] : 40;
        $AxisRo = isset($Format["AxisR"]) ? $Format["AxisR"] : 0;
        $AxisGo = isset($Format["AxisG"]) ? $Format["AxisG"] : 0;
        $AxisBo = isset($Format["AxisB"]) ? $Format["AxisB"] : 0;
        $AxisAlpha = isset($Format["AxisAlpha"]) ? $Format["AxisAlpha"] : 100;
        $TickRo = isset($Format["TickR"]) ? $Format["TickR"] : 0;
        $TickGo = isset($Format["TickG"]) ? $Format["TickG"] : 0;
        $TickBo = isset($Format["TickB"]) ? $Format["TickB"] : 0;
        $TickAlpha = isset($Format["TickAlpha"]) ? $Format["TickAlpha"] : 100;
        $DrawSubTicks = isset($Format["DrawSubTicks"]) ? $Format["DrawSubTicks"] : false;
        $InnerSubTickWidth = isset($Format["InnerSubTickWidth"]) ? $Format["InnerSubTickWidth"] : 0;
        $OuterSubTickWidth = isset($Format["OuterSubTickWidth"]) ? $Format["OuterSubTickWidth"] : 2;
        $SubTickR = isset($Format["SubTickR"]) ? $Format["SubTickR"] : 255;
        $SubTickG = isset($Format["SubTickG"]) ? $Format["SubTickG"] : 0;
        $SubTickB = isset($Format["SubTickB"]) ? $Format["SubTickB"] : 0;
        $SubTickAlpha = isset($Format["SubTickAlpha"]) ? $Format["SubTickAlpha"] : 100;
        $XReleasePercent = isset($Format["XReleasePercent"]) ? $Format["XReleasePercent"] : 1;
        $DrawArrows = isset($Format["DrawArrows"]) ? $Format["DrawArrows"] : false;
        $ArrowSize = isset($Format["ArrowSize"]) ? $Format["ArrowSize"] : 8;
        $CycleBackground = isset($Format["CycleBackground"]) ? $Format["CycleBackground"] : false;
        $BackgroundR1 = isset($Format["BackgroundR1"]) ? $Format["BackgroundR1"] : 255;
        $BackgroundG1 = isset($Format["BackgroundG1"]) ? $Format["BackgroundG1"] : 255;
        $BackgroundB1 = isset($Format["BackgroundB1"]) ? $Format["BackgroundB1"] : 255;
        $BackgroundAlpha1 = isset($Format["BackgroundAlpha1"]) ? $Format["BackgroundAlpha1"] : 10;
        $BackgroundR2 = isset($Format["BackgroundR2"]) ? $Format["BackgroundR2"] : 230;
        $BackgroundG2 = isset($Format["BackgroundG2"]) ? $Format["BackgroundG2"] : 230;
        $BackgroundB2 = isset($Format["BackgroundB2"]) ? $Format["BackgroundB2"] : 230;
        $BackgroundAlpha2 = isset($Format["BackgroundAlpha2"]) ? $Format["BackgroundAlpha2"] : 10;

        /* Check if we have at least both one X and Y axis */
        $GotXAxis = false;
        $GotYAxis = false;
        foreach ($this->pDataObject->Data["Axis"] as $AxisID => $AxisSettings) {
            if ($AxisSettings["Identity"] == AXIS_X) {
                $GotXAxis = true;
            }
            if ($AxisSettings["Identity"] == AXIS_Y) {
                $GotYAxis = true;
            }
        }
        if (!$GotXAxis) {
            return SCATTER_MISSING_X_SERIE;
        }
        if (!$GotYAxis) {
            return SCATTER_MISSING_Y_SERIE;
        }

        /* Skip a NOTICE event in case of an empty array */
        if ($DrawYLines == NONE) {
            $DrawYLines = ["zarma" => "31"];
        }

        $Data = $this->pDataObject->getData();

        foreach ($Data["Axis"] as $AxisID => $AxisSettings) {
            if ($AxisSettings["Identity"] == AXIS_X) {
                $Width = $this->pChartObject->GraphAreaX2 - $this->pChartObject->GraphAreaX1 - $XMargin * 2;
            } else {
                $Width = $this->pChartObject->GraphAreaY2 - $this->pChartObject->GraphAreaY1 - $YMargin * 2;
            }

            $AxisMin = ABSOLUTE_MAX;
            $AxisMax = OUT_OF_SIGHT;
            if ($Mode == SCALE_MODE_FLOATING) {
                foreach ($Data["Series"] as $SerieID => $SerieParameter) {
                    if ($SerieParameter["Axis"] == $AxisID
                        && $Data["Series"][$SerieID]["isDrawable"]
                    ) {
                        $AxisMax = max($AxisMax, $Data["Series"][$SerieID]["Max"]);
                        $AxisMin = min($AxisMin, $Data["Series"][$SerieID]["Min"]);
                    }
                }
                $AutoMargin = (($AxisMax - $AxisMin) / 100) * $XReleasePercent;

                $Data["Axis"][$AxisID]["Min"] = $AxisMin - $AutoMargin;
                $Data["Axis"][$AxisID]["Max"] = $AxisMax + $AutoMargin;
            } elseif ($Mode == SCALE_MODE_MANUAL) {
                if (isset($ManualScale[$AxisID]["Min"])
                    && isset($ManualScale[$AxisID]["Max"])
                ) {
                    $Data["Axis"][$AxisID]["Min"] = $ManualScale[$AxisID]["Min"];
                    $Data["Axis"][$AxisID]["Max"] = $ManualScale[$AxisID]["Max"];
                } else {
                    throw new Exception("Manual scale boundaries not set.");
                }
            }

            /* Full manual scale */
            if (isset($ManualScale[$AxisID]["Rows"]) && isset($ManualScale[$AxisID]["RowHeight"])) {
                $Scale = [
                    "Rows" => $ManualScale[$AxisID]["Rows"],
                    "RowHeight" => $ManualScale[$AxisID]["RowHeight"],
                    "XMin" => $ManualScale[$AxisID]["Min"],
                    "XMax" => $ManualScale[$AxisID]["Max"]
                ];
            } else {
                $MaxDivs = floor($Width / $MinDivHeight);
                $Scale = $this->pChartObject->computeScale(
                    $Data["Axis"][$AxisID]["Min"],
                    $Data["Axis"][$AxisID]["Max"],
                    $MaxDivs,
                    $Factors,
                    $AxisID
                );
            }

            $Data["Axis"][$AxisID]["Margin"] = $AxisSettings["Identity"] == AXIS_X ? $XMargin : $YMargin;
            $Data["Axis"][$AxisID]["ScaleMin"] = $Scale["XMin"];
            $Data["Axis"][$AxisID]["ScaleMax"] = $Scale["XMax"];
            $Data["Axis"][$AxisID]["Rows"] = $Scale["Rows"];
            $Data["Axis"][$AxisID]["RowHeight"] = $Scale["RowHeight"];

            if (isset($Scale["Format"])) {
                $Data["Axis"][$AxisID]["Format"] = $Scale["Format"];
            }

            if (!isset($Data["Axis"][$AxisID]["Display"])) {
                $Data["Axis"][$AxisID]["Display"] = null;
            }
            if (!isset($Data["Axis"][$AxisID]["Format"])) {
                $Data["Axis"][$AxisID]["Format"] = null;
            }
            if (!isset($Data["Axis"][$AxisID]["Unit"])) {
                $Data["Axis"][$AxisID]["Unit"] = null;
            }
        }

        /* Get the default font color */
        $FontColorRo = $this->pChartObject->FontColorR;
        $FontColorGo = $this->pChartObject->FontColorG;
        $FontColorBo = $this->pChartObject->FontColorB;

        /* Set the original boundaries */
        $AxisPos["L"] = $this->pChartObject->GraphAreaX1;
        $AxisPos["R"] = $this->pChartObject->GraphAreaX2;
        $AxisPos["T"] = $this->pChartObject->GraphAreaY1;
        $AxisPos["B"] = $this->pChartObject->GraphAreaY2;

        foreach ($Data["Axis"] as $AxisID => $AxisSettings) {
            if (isset($AxisSettings["Color"])) {
                $AxisR = $AxisSettings["Color"]["R"];
                $AxisG = $AxisSettings["Color"]["G"];
                $AxisB = $AxisSettings["Color"]["B"];
                $TickR = $AxisSettings["Color"]["R"];
                $TickG = $AxisSettings["Color"]["G"];
                $TickB = $AxisSettings["Color"]["B"];
                $this->pChartObject->setFontProperties(
                    [
                        "R" => $AxisSettings["Color"]["R"],
                        "G" => $AxisSettings["Color"]["G"],
                        "B" => $AxisSettings["Color"]["B"]
                    ]
                );
            } else {
                $AxisR = $AxisRo;
                $AxisG = $AxisGo;
                $AxisB = $AxisBo;
                $TickR = $TickRo;
                $TickG = $TickGo;
                $TickB = $TickBo;
                $this->pChartObject->setFontProperties(
                    ["R" => $FontColorRo, "G" => $FontColorGo, "B" => $FontColorBo]
                );
            }

            if ($AxisSettings["Identity"] == AXIS_X) {
                if ($AxisSettings["Position"] == AXIS_POSITION_BOTTOM) {
                    if ($XLabelsRotation == 0) {
                        $LabelAlign = TEXT_ALIGN_TOPMIDDLE;
                        $LabelOffset = 2;
                    }
                    if ($XLabelsRotation > 0 && $XLabelsRotation < 190) {
                        $LabelAlign = TEXT_ALIGN_MIDDLERIGHT;
                        $LabelOffset = 5;
                    }
                    if ($XLabelsRotation == 180) {
                        $LabelAlign = TEXT_ALIGN_BOTTOMMIDDLE;
                        $LabelOffset = 5;
                    }
                    if ($XLabelsRotation > 180 && $XLabelsRotation < 360) {
                        $LabelAlign = TEXT_ALIGN_MIDDLELEFT;
                        $LabelOffset = 2;
                    }

                    if ($Floating) {
                        $FloatingOffset = $YMargin;
                        $this->pChartObject->drawLine(
                            $this->pChartObject->GraphAreaX1 + $AxisSettings["Margin"],
                            $AxisPos["B"],
                            $this->pChartObject->GraphAreaX2 - $AxisSettings["Margin"],
                            $AxisPos["B"],
                            ["R" => $AxisR, "G" => $AxisG, "B" => $AxisB, "Alpha" => $AxisAlpha]
                        );
                    } else {
                        $FloatingOffset = 0;
                        $this->pChartObject->drawLine(
                            $this->pChartObject->GraphAreaX1,
                            $AxisPos["B"],
                            $this->pChartObject->GraphAreaX2,
                            $AxisPos["B"],
                            ["R" => $AxisR, "G" => $AxisG, "B" => $AxisB, "Alpha" => $AxisAlpha]
                        );
                    }

                    if ($DrawArrows) {
                        $this->pChartObject->drawArrow(
                            $this->pChartObject->GraphAreaX2 - $AxisSettings["Margin"],
                            $AxisPos["B"],
                            $this->pChartObject->GraphAreaX2 + ($ArrowSize * 2),
                            $AxisPos["B"],
                            ["FillR" => $AxisR, "FillG" => $AxisG, "FillB" => $AxisB, "Size" => $ArrowSize]
                        );
                    }

                    $Width = ($this->pChartObject->GraphAreaX2 - $this->pChartObject->GraphAreaX1)
                        - $AxisSettings["Margin"] * 2
                    ;
                    $Step = $Width / $AxisSettings["Rows"];
                    $SubTicksSize = $Step / 2;
                    $MaxBottom = $AxisPos["B"];
                    $LastX = null;
                    for ($i = 0; $i <= $AxisSettings["Rows"]; $i++) {
                        $XPos = $this->pChartObject->GraphAreaX1 + $AxisSettings["Margin"] + $Step * $i;
                        $YPos = $AxisPos["B"];
                        $Value = $this->pChartObject->scaleFormat(
                            $AxisSettings["ScaleMin"] + $AxisSettings["RowHeight"] * $i,
                            $AxisSettings["Display"],
                            $AxisSettings["Format"],
                            $AxisSettings["Unit"]
                        );

                        if ($i % 2 == 1) {
                            $BGColor = [
                                "R" => $BackgroundR1,
                                "G" => $BackgroundG1,
                                "B" => $BackgroundB1,
                                "Alpha" => $BackgroundAlpha1
                            ];
                        } else {
                            $BGColor = [
                                "R" => $BackgroundR2,
                                "G" => $BackgroundG2,
                                "B" => $BackgroundB2,
                                "Alpha" => $BackgroundAlpha2
                            ];
                        }
                        if ($LastX != null
                            && $CycleBackground
                            && ($DrawXLines == ALL || in_array($AxisID, $DrawXLines))
                        ) {
                            $this->pChartObject->drawFilledRectangle(
                                $LastX,
                                $this->pChartObject->GraphAreaY1 + $FloatingOffset,
                                $XPos,
                                $this->pChartObject->GraphAreaY2 - $FloatingOffset,
                                $BGColor
                            );
                        }

                        if ($DrawXLines == ALL || in_array($AxisID, $DrawXLines)) {
                            $this->pChartObject->drawLine(
                                $XPos,
                                $this->pChartObject->GraphAreaY1 + $FloatingOffset,
                                $XPos,
                                $this->pChartObject->GraphAreaY2 - $FloatingOffset,
                                [
                                    "R" => $GridR,
                                    "G" => $GridG,
                                    "B" => $GridB,
                                    "Alpha" => $GridAlpha,
                                    "Ticks" => $GridTicks
                                ]
                            );
                        }
                        if ($DrawSubTicks && $i != $AxisSettings["Rows"]) {
                            $this->pChartObject->drawLine(
                                $XPos + $SubTicksSize,
                                $YPos - $InnerSubTickWidth,
                                $XPos + $SubTicksSize,
                                $YPos + $OuterSubTickWidth,
                                [
                                    "R" => $SubTickR,
                                    "G" => $SubTickG,
                                    "B" => $SubTickB,
                                    "Alpha" => $SubTickAlpha
                                ]
                            );
                        }
                        $this->pChartObject->drawLine(
                            $XPos,
                            $YPos - $InnerTickWidth,
                            $XPos,
                            $YPos + $OuterTickWidth,
                            ["R" => $TickR, "G" => $TickG, "B" => $TickB, "Alpha" => $TickAlpha]
                        );
                        $Bounds = $this->pChartObject->drawText(
                            $XPos,
                            $YPos + $OuterTickWidth + $LabelOffset,
                            $Value,
                            ["Angle" => $XLabelsRotation, "Align" => $LabelAlign]
                        );
                        $TxtBottom = $YPos + 2 + $OuterTickWidth + 2 + ($Bounds[0]["Y"] - $Bounds[2]["Y"]);
                        $MaxBottom = max($MaxBottom, $TxtBottom);

                        $LastX = $XPos;
                    }

                    if (isset($AxisSettings["Name"])) {
                        $YPos = $MaxBottom + 2;
                        $XPos = $this->pChartObject->GraphAreaX1
                            + ($this->pChartObject->GraphAreaX2 - $this->pChartObject->GraphAreaX1) / 2
                        ;
                        $Bounds = $this->pChartObject->drawText(
                            $XPos,
                            $YPos,
                            $AxisSettings["Name"],
                            ["Align" => TEXT_ALIGN_TOPMIDDLE]
                        );
                        $MaxBottom = $Bounds[0]["Y"];

                        $this->pDataObject->Data["GraphArea"]["Y2"] = $MaxBottom + $this->pChartObject->FontSize;
                    }

                    $AxisPos["B"] = $MaxBottom + $ScaleSpacing;
                } elseif ($AxisSettings["Position"] == AXIS_POSITION_TOP) {
                    if ($XLabelsRotation == 0) {
                        $LabelAlign = TEXT_ALIGN_BOTTOMMIDDLE;
                        $LabelOffset = 2;
                    }
                    if ($XLabelsRotation > 0 && $XLabelsRotation < 190) {
                        $LabelAlign = TEXT_ALIGN_MIDDLELEFT;
                        $LabelOffset = 2;
                    }
                    if ($XLabelsRotation == 180) {
                        $LabelAlign = TEXT_ALIGN_TOPMIDDLE;
                        $LabelOffset = 5;
                    }
                    if ($XLabelsRotation > 180 && $XLabelsRotation < 360) {
                        $LabelAlign = TEXT_ALIGN_MIDDLERIGHT;
                        $LabelOffset = 5;
                    }

                    if ($Floating) {
                        $FloatingOffset = $YMargin;
                        $this->pChartObject->drawLine(
                            $this->pChartObject->GraphAreaX1 + $AxisSettings["Margin"],
                            $AxisPos["T"],
                            $this->pChartObject->GraphAreaX2 - $AxisSettings["Margin"],
                            $AxisPos["T"],
                            ["R" => $AxisR, "G" => $AxisG, "B" => $AxisB, "Alpha" => $AxisAlpha]
                        );
                    } else {
                        $FloatingOffset = 0;
                        $this->pChartObject->drawLine(
                            $this->pChartObject->GraphAreaX1,
                            $AxisPos["T"],
                            $this->pChartObject->GraphAreaX2,
                            $AxisPos["T"],
                            ["R" => $AxisR, "G" => $AxisG, "B" => $AxisB, "Alpha" => $AxisAlpha]
                        );
                    }

                    if ($DrawArrows) {
                        $this->pChartObject->drawArrow(
                            $this->pChartObject->GraphAreaX2 - $AxisSettings["Margin"],
                            $AxisPos["T"],
                            $this->pChartObject->GraphAreaX2 + ($ArrowSize * 2),
                            $AxisPos["T"],
                            [
                                "FillR" => $AxisR,
                                "FillG" => $AxisG,
                                "FillB" => $AxisB,
                                "Size" => $ArrowSize
                            ]
                        );
                    }

                    $Width = ($this->pChartObject->GraphAreaX2 - $this->pChartObject->GraphAreaX1)
                        - $AxisSettings["Margin"] * 2
                    ;
                    $Step = $Width / $AxisSettings["Rows"];
                    $SubTicksSize = $Step / 2;
                    $MinTop = $AxisPos["T"];
                    $LastX = null;
                    for ($i = 0; $i <= $AxisSettings["Rows"]; $i++) {
                        $XPos = $this->pChartObject->GraphAreaX1 + $AxisSettings["Margin"] + $Step * $i;
                        $YPos = $AxisPos["T"];
                        $Value = $this->pChartObject->scaleFormat(
                            $AxisSettings["ScaleMin"] + $AxisSettings["RowHeight"] * $i,
                            $AxisSettings["Display"],
                            $AxisSettings["Format"],
                            $AxisSettings["Unit"]
                        );

                        if ($i % 2 == 1) {
                            $BGColor = [
                                "R" => $BackgroundR1,
                                "G" => $BackgroundG1,
                                "B" => $BackgroundB1,
                                "Alpha" => $BackgroundAlpha1
                            ];
                        } else {
                            $BGColor = [
                                "R" => $BackgroundR2,
                                "G" => $BackgroundG2,
                                "B" => $BackgroundB2,
                                "Alpha" => $BackgroundAlpha2
                            ];
                        }
                        if ($LastX != null
                            && $CycleBackground
                            && ($DrawXLines == ALL || in_array($AxisID, $DrawXLines))
                        ) {
                            $this->pChartObject->drawFilledRectangle(
                                $LastX,
                                $this->pChartObject->GraphAreaY1 + $FloatingOffset,
                                $XPos,
                                $this->pChartObject->GraphAreaY2 - $FloatingOffset,
                                $BGColor
                            );
                        }

                        if ($DrawXLines == ALL || in_array($AxisID, $DrawXLines)) {
                            $this->pChartObject->drawLine(
                                $XPos,
                                $this->pChartObject->GraphAreaY1 + $FloatingOffset,
                                $XPos,
                                $this->pChartObject->GraphAreaY2 - $FloatingOffset,
                                [
                                    "R" => $GridR,
                                    "G" => $GridG,
                                    "B" => $GridB,
                                    "Alpha" => $GridAlpha,
                                    "Ticks" => $GridTicks
                                ]
                            );
                        }

                        if ($DrawSubTicks && $i != $AxisSettings["Rows"]) {
                            $this->pChartObject->drawLine(
                                $XPos + $SubTicksSize,
                                $YPos - $OuterSubTickWidth,
                                $XPos + $SubTicksSize,
                                $YPos + $InnerSubTickWidth,
                                [
                                    "R" => $SubTickR,
                                    "G" => $SubTickG,
                                    "B" => $SubTickB,
                                    "Alpha" => $SubTickAlpha
                                ]
                            );
                        }
                        $this->pChartObject->drawLine(
                            $XPos,
                            $YPos - $OuterTickWidth,
                            $XPos,
                            $YPos + $InnerTickWidth,
                            ["R" => $TickR, "G" => $TickG, "B" => $TickB, "Alpha" => $TickAlpha]
                        );
                        $Bounds = $this->pChartObject->drawText(
                            $XPos,
                            $YPos - $OuterTickWidth - $LabelOffset,
                            $Value,
                            ["Angle" => $XLabelsRotation, "Align" => $LabelAlign]
                        );
                        $TxtBox = $YPos - $OuterTickWidth - 4 - ($Bounds[0]["Y"] - $Bounds[2]["Y"]);
                        $MinTop = min($MinTop, $TxtBox);

                        $LastX = $XPos;
                    }

                    if (isset($AxisSettings["Name"])) {
                        $YPos = $MinTop - 2;
                        $XPos = $this->pChartObject->GraphAreaX1
                            + ($this->pChartObject->GraphAreaX2 - $this->pChartObject->GraphAreaX1) / 2
                        ;
                        $Bounds = $this->pChartObject->drawText(
                            $XPos,
                            $YPos,
                            $AxisSettings["Name"],
                            ["Align" => TEXT_ALIGN_BOTTOMMIDDLE]
                        );
                        $MinTop = $Bounds[2]["Y"];

                        $this->pDataObject->Data["GraphArea"]["Y1"] = $MinTop;
                    }

                    $AxisPos["T"] = $MinTop - $ScaleSpacing;
                }
            } elseif ($AxisSettings["Identity"] == AXIS_Y) {
                if ($AxisSettings["Position"] == AXIS_POSITION_LEFT) {
                    if ($Floating) {
                        $FloatingOffset = $XMargin;
                        $this->pChartObject->drawLine(
                            $AxisPos["L"],
                            $this->pChartObject->GraphAreaY1 + $AxisSettings["Margin"],
                            $AxisPos["L"],
                            $this->pChartObject->GraphAreaY2 - $AxisSettings["Margin"],
                            ["R" => $AxisR, "G" => $AxisG, "B" => $AxisB, "Alpha" => $AxisAlpha]
                        );
                    } else {
                        $FloatingOffset = 0;
                        $this->pChartObject->drawLine(
                            $AxisPos["L"],
                            $this->pChartObject->GraphAreaY1,
                            $AxisPos["L"],
                            $this->pChartObject->GraphAreaY2,
                            ["R" => $AxisR, "G" => $AxisG, "B" => $AxisB, "Alpha" => $AxisAlpha]
                        );
                    }

                    if ($DrawArrows) {
                        $this->pChartObject->drawArrow(
                            $AxisPos["L"],
                            $this->pChartObject->GraphAreaY1 + $AxisSettings["Margin"],
                            $AxisPos["L"],
                            $this->pChartObject->GraphAreaY1 - ($ArrowSize * 2),
                            [
                                "FillR" => $AxisR,
                                "FillG" => $AxisG,
                                "FillB" => $AxisB,
                                "Size" => $ArrowSize
                            ]
                        );
                    }

                    $Height = ($this->pChartObject->GraphAreaY2 - $this->pChartObject->GraphAreaY1)
                        - $AxisSettings["Margin"] * 2
                    ;
                    $Step = $Height / $AxisSettings["Rows"];
                    $SubTicksSize = $Step / 2;
                    $MinLeft = $AxisPos["L"];
                    $LastY = null;
                    for ($i = 0; $i <= $AxisSettings["Rows"]; $i++) {
                        $YPos = $this->pChartObject->GraphAreaY2 - $AxisSettings["Margin"] - $Step * $i;
                        $XPos = $AxisPos["L"];
                        $Value = $this->pChartObject->scaleFormat(
                            $AxisSettings["ScaleMin"] + $AxisSettings["RowHeight"] * $i,
                            $AxisSettings["Display"],
                            $AxisSettings["Format"],
                            $AxisSettings["Unit"]
                        );

                        if ($i % 2 == 1) {
                            $BGColor = [
                                "R" => $BackgroundR1,
                                "G" => $BackgroundG1,
                                "B" => $BackgroundB1,
                                "Alpha" => $BackgroundAlpha1
                            ];
                        } else {
                            $BGColor = [
                                "R" => $BackgroundR2,
                                "G" => $BackgroundG2,
                                "B" => $BackgroundB2,
                                "Alpha" => $BackgroundAlpha2
                            ];
                        }
                        if ($LastY != null
                            && $CycleBackground
                            && ($DrawYLines == ALL || in_array($AxisID, $DrawYLines))
                        ) {
                            $this->pChartObject->drawFilledRectangle(
                                $this->pChartObject->GraphAreaX1 + $FloatingOffset,
                                $LastY,
                                $this->pChartObject->GraphAreaX2 - $FloatingOffset,
                                $YPos,
                                $BGColor
                            );
                        }

                        if (($YPos != $this->pChartObject->GraphAreaY1 && $YPos != $this->pChartObject->GraphAreaY2)
                            && ($DrawYLines == ALL || in_array($AxisID, $DrawYLines))
                        ) {
                            $this->pChartObject->drawLine(
                                $this->pChartObject->GraphAreaX1 + $FloatingOffset,
                                $YPos,
                                $this->pChartObject->GraphAreaX2 - $FloatingOffset,
                                $YPos,
                                [
                                    "R" => $GridR,
                                    "G" => $GridG,
                                    "B" => $GridB,
                                    "Alpha" => $GridAlpha,
                                    "Ticks" => $GridTicks
                                ]
                            );
                        }

                        if ($DrawSubTicks && $i != $AxisSettings["Rows"]) {
                            $this->pChartObject->drawLine(
                                $XPos - $OuterSubTickWidth,
                                $YPos - $SubTicksSize,
                                $XPos + $InnerSubTickWidth,
                                $YPos - $SubTicksSize,
                                [
                                    "R" => $SubTickR,
                                    "G" => $SubTickG,
                                    "B" => $SubTickB,
                                    "Alpha" => $SubTickAlpha
                                ]
                            );
                        }
                        $this->pChartObject->drawLine(
                            $XPos - $OuterTickWidth,
                            $YPos,
                            $XPos + $InnerTickWidth,
                            $YPos,
                            ["R" => $TickR, "G" => $TickG, "B" => $TickB, "Alpha" => $TickAlpha]
                        );
                        $Bounds = $this->pChartObject->drawText(
                            $XPos - $OuterTickWidth - 2,
                            $YPos,
                            $Value,
                            ["Align" => TEXT_ALIGN_MIDDLERIGHT]
                        );
                        $TxtLeft = $XPos - $OuterTickWidth - 2 - ($Bounds[1]["X"] - $Bounds[0]["X"]);
                        $MinLeft = min($MinLeft, $TxtLeft);

                        $LastY = $YPos;
                    }

                    if (isset($AxisSettings["Name"])) {
                        $XPos = $MinLeft - 2;
                        $YPos = $this->pChartObject->GraphAreaY1
                            + ($this->pChartObject->GraphAreaY2 - $this->pChartObject->GraphAreaY1) / 2
                        ;
                        $Bounds = $this->pChartObject->drawText(
                            $XPos,
                            $YPos,
                            $AxisSettings["Name"],
                            ["Align" => TEXT_ALIGN_BOTTOMMIDDLE, "Angle" => 90]
                        );
                        $MinLeft = $Bounds[2]["X"];

                        $this->pDataObject->Data["GraphArea"]["X1"] = $MinLeft;
                    }

                    $AxisPos["L"] = $MinLeft - $ScaleSpacing;
                } elseif ($AxisSettings["Position"] == AXIS_POSITION_RIGHT) {
                    if ($Floating) {
                        $FloatingOffset = $XMargin;
                        $this->pChartObject->drawLine(
                            $AxisPos["R"],
                            $this->pChartObject->GraphAreaY1 + $AxisSettings["Margin"],
                            $AxisPos["R"],
                            $this->pChartObject->GraphAreaY2 - $AxisSettings["Margin"],
                            ["R" => $AxisR, "G" => $AxisG, "B" => $AxisB, "Alpha" => $AxisAlpha]
                        );
                    } else {
                        $FloatingOffset = 0;
                        $this->pChartObject->drawLine(
                            $AxisPos["R"],
                            $this->pChartObject->GraphAreaY1,
                            $AxisPos["R"],
                            $this->pChartObject->GraphAreaY2,
                            ["R" => $AxisR, "G" => $AxisG, "B" => $AxisB, "Alpha" => $AxisAlpha]
                        );
                    }

                    if ($DrawArrows) {
                        $this->pChartObject->drawArrow(
                            $AxisPos["R"],
                            $this->pChartObject->GraphAreaY1 + $AxisSettings["Margin"],
                            $AxisPos["R"],
                            $this->pChartObject->GraphAreaY1 - ($ArrowSize * 2),
                            [
                                "FillR" => $AxisR,
                                "FillG" => $AxisG,
                                "FillB" => $AxisB,
                                "Size" => $ArrowSize
                            ]
                        );
                    }

                    $Height = ($this->pChartObject->GraphAreaY2 - $this->pChartObject->GraphAreaY1)
                        - $AxisSettings["Margin"] * 2
                    ;
                    $Step = $Height / $AxisSettings["Rows"];
                    $SubTicksSize = $Step / 2;
                    $MaxLeft = $AxisPos["R"];
                    $LastY = null;
                    for ($i = 0; $i <= $AxisSettings["Rows"]; $i++) {
                        $YPos = $this->pChartObject->GraphAreaY2 - $AxisSettings["Margin"] - $Step * $i;
                        $XPos = $AxisPos["R"];
                        $Value = $this->pChartObject->scaleFormat(
                            $AxisSettings["ScaleMin"] + $AxisSettings["RowHeight"] * $i,
                            $AxisSettings["Display"],
                            $AxisSettings["Format"],
                            $AxisSettings["Unit"]
                        );

                        if ($i % 2 == 1) {
                            $BGColor = [
                                "R" => $BackgroundR1,
                                "G" => $BackgroundG1,
                                "B" => $BackgroundB1,
                                "Alpha" => $BackgroundAlpha1
                            ];
                        } else {
                            $BGColor = [
                                "R" => $BackgroundR2,
                                "G" => $BackgroundG2,
                                "B" => $BackgroundB2,
                                "Alpha" => $BackgroundAlpha2
                            ];
                        }
                        if ($LastY != null
                            && $CycleBackground
                            && ($DrawYLines == ALL || in_array($AxisID, $DrawYLines))
                        ) {
                            $this->pChartObject->drawFilledRectangle(
                                $this->pChartObject->GraphAreaX1 + $FloatingOffset,
                                $LastY,
                                $this->pChartObject->GraphAreaX2 - $FloatingOffset,
                                $YPos,
                                $BGColor
                            );
                        }

                        if (($YPos != $this->pChartObject->GraphAreaY1
                            && $YPos != $this->pChartObject->GraphAreaY2)
                            && ($DrawYLines == ALL || in_array($AxisID, $DrawYLines))
                        ) {
                            $this->pChartObject->drawLine(
                                $this->pChartObject->GraphAreaX1 + $FloatingOffset,
                                $YPos,
                                $this->pChartObject->GraphAreaX2 - $FloatingOffset,
                                $YPos,
                                [
                                    "R" => $GridR,
                                    "G" => $GridG,
                                    "B" => $GridB,
                                    "Alpha" => $GridAlpha,
                                    "Ticks" => $GridTicks
                                ]
                            );
                        }

                        if ($DrawSubTicks && $i != $AxisSettings["Rows"]) {
                            $this->pChartObject->drawLine(
                                $XPos - $InnerSubTickWidth,
                                $YPos - $SubTicksSize,
                                $XPos + $OuterSubTickWidth,
                                $YPos - $SubTicksSize,
                                [
                                    "R" => $SubTickR,
                                    "G" => $SubTickG,
                                    "B" => $SubTickB,
                                    "Alpha" => $SubTickAlpha
                                ]
                            );
                        }
                        $this->pChartObject->drawLine(
                            $XPos - $InnerTickWidth,
                            $YPos,
                            $XPos + $OuterTickWidth,
                            $YPos,
                            ["R" => $TickR, "G" => $TickG, "B" => $TickB, "Alpha" => $TickAlpha]
                        );
                        $Bounds = $this->pChartObject->drawText(
                            $XPos + $OuterTickWidth + 2,
                            $YPos,
                            $Value,
                            ["Align" => TEXT_ALIGN_MIDDLELEFT]
                        );
                        $TxtLeft = $XPos + $OuterTickWidth + 2 + ($Bounds[1]["X"] - $Bounds[0]["X"]);
                        $MaxLeft = max($MaxLeft, $TxtLeft);

                        $LastY = $YPos;
                    }

                    if (isset($AxisSettings["Name"])) {
                        $XPos = $MaxLeft + 6;
                        $YPos = $this->pChartObject->GraphAreaY1
                            + ($this->pChartObject->GraphAreaY2 - $this->pChartObject->GraphAreaY1) / 2
                        ;
                        $Bounds = $this->pChartObject->drawText(
                            $XPos,
                            $YPos,
                            $AxisSettings["Name"],
                            ["Align" => TEXT_ALIGN_BOTTOMMIDDLE, "Angle" => 270]
                        );
                        $MaxLeft = $Bounds[2]["X"];

                        $this->pDataObject->Data["GraphArea"]["X2"] = $MaxLeft + $this->pChartObject->FontSize;
                    }

                    $AxisPos["R"] = $MaxLeft + $ScaleSpacing;
                }
            }
        }

        $this->pDataObject->saveAxisConfig($Data["Axis"]);
    }
815040
protected function interpolateContext(string $format, array $context = []): string {
        $final = preg_replace_callback('/{([^\s][^}]+[^\s]?)}/', function ($matches) use ($context) {
            $field = trim($matches[1], '{}');
            if (array_key_exists($field, $context)) {
                return $context[$field];
            } else {
                return $matches[1];
            }
        }, $format);
        return $final;
    }
1161388
public function format($format) {

		if(false === is_string($format)) {
			return trigger_error(sprintf('Argument 1 passed to %s() must be of the type string, "%s" given', __METHOD__, gettype($format)), E_USER_ERROR);
		}

		$this -> format = $format;

		return $this;
	}
333465
public function format($format = null) {
        if(is_null($format)) {
            $format = $this->getFormatter()->getDateTimeFormat();
        }
        return date($format, $this->getEpoch());
    }
865888
public function render($format = null)
    {
        if ( ! is_null($format) )
            $this->setFormat($format);

        $this->setHeaderResponse();
        call_user_func($this->getFunctionName(), $this->getImage());
    }
839036
final public function format($format)
    {
        if(is_null($this->value)) {
            return null;
        } else {
            return $this->value->format($format);
        }
    }
812679
public function setFormat($format)
    {
        if (empty($format) || !is_string($format)) {

            throw new Zend_Validate_Exception("A postcode-format string has to be given for validation");
        }

        if ($format[0] !== '/') {
            $format = '/^' . $format;
        }

        if ($format[strlen($format) - 1] !== '/') {
            $format .= '$/';
        }

        $this->_format = $format;
        return $this;
    }
20359
public function normalize($object, $format = null, array $context = [])
    {
        $asArray = $this->objectNormalizer->normalize($object, $this->format, $context);
        // Exclude null values from the output, even if PATCH is not supported on Apigee Edge
        // sending a smaller portion of data in POST/PUT is always a good practice.
        $asArray = array_filter($asArray, function ($value) {
            return !is_null($value);
        });
        ksort($asArray);

        return (object) $asArray;
    }
962685
public function setFormat($format)
    {
        $result = true;
        if (($this->debug === true) && !empty($this->evidence) && isset(Formats::$$this->evidence)) {
            if (array_key_exists($format, array_flip(Formats::$$this->evidence))
                === false) {
                $result = false;
            }
        }
        if ($result === true) {
            $this->format = $format;
            $this->updateApiURL();
        }
        return $result;
    }
1296812
public function setFormat($format) {

        $this->checkInArray($format, GDAXConstants::$reportFormatValues);
        $this->format = $format;
        return $this;

    }
994203
public function format(string $format) : self
    {
        if (! in_array($format, self::VALID_FORMATS)) {
            throw new Exception('Invalid format provided to path.');
        }

        $this->format = $format;

        return $this;
    }
1374670
public static function getFormatter($format)
    {
        foreach (self::getList() as $class => $path) {
            if (! in_array(strtolower($format), array_map('strtolower', $class::getFormatString()))) {
                continue;
            }

            return new $class();
        }

        throw new UnknownFormatException('There is no formater for this format');
    }
634054
public function getIp($format = self::FORMAT_HEX)
    {
        if ($this->ipHex === null) {
            return null;
        } elseif ($format === self::FORMAT_HEX) {
            return $this->ipHex;
        } elseif ($format === self::FORMAT_IP_STRING) {
            return inet_ntop($this->hex2bin($this->ipHex));
        }
        throw new \Exception('Invalid IP format');
    }
466065
public static function create(string $format = SerializerBuilder::DEFAULT_FORMAT) : SerializerInterface
    {
        return SerializerBuilder::instance()->setFormat($format)->build();
    }
889178
public function setResponseFormat($format)
    {
        $format = strtolower($format);
        if (!in_array($format, array('php', 'json', 'jsonp'))) {
            throw new Exception("Expected a format of php, json or jsonp, got '$format'");
        } else {
            $this->responseFormat = $format;
        }
    }
599132
public function extract($format, $carrier){
        if($format == Formats\TEXT_MAP){
            return $this->propagator->extract($format, $carrier);
        }else{
            throw new \Exception("not support format");
        }
    }
1158991
public function setFormat($format)
    {
        if (JFactory::getApplication()->getCfg('sef_suffix') && $format === 'feed') {
            $format = 'rss';
        }

        return parent::setFormat($format);
    }