Draw a plot chart
@param array $Format
548956
public function drawPlotChart(array $Format = [])
    {
        $PlotSize = isset($Format["PlotSize"]) ? $Format["PlotSize"] : null;
        $PlotBorder = isset($Format["PlotBorder"]) ? $Format["PlotBorder"] : false;
        $BorderR = isset($Format["BorderR"]) ? $Format["BorderR"] : 50;
        $BorderG = isset($Format["BorderG"]) ? $Format["BorderG"] : 50;
        $BorderB = isset($Format["BorderB"]) ? $Format["BorderB"] : 50;
        $BorderAlpha = isset($Format["BorderAlpha"]) ? $Format["BorderAlpha"] : 30;
        $BorderSize = isset($Format["BorderSize"]) ? $Format["BorderSize"] : 2;
        $Surrounding = isset($Format["Surrounding"]) ? $Format["Surrounding"] : null;
        $DisplayValues = isset($Format["DisplayValues"]) ? $Format["DisplayValues"] : false;
        $DisplayOffset = isset($Format["DisplayOffset"]) ? $Format["DisplayOffset"] : 4;
        $DisplayColor = isset($Format["DisplayColor"]) ? $Format["DisplayColor"] : DISPLAY_MANUAL;
        $DisplayR = isset($Format["DisplayR"]) ? $Format["DisplayR"] : 0;
        $DisplayG = isset($Format["DisplayG"]) ? $Format["DisplayG"] : 0;
        $DisplayB = isset($Format["DisplayB"]) ? $Format["DisplayB"] : 0;
        $RecordImageMap = isset($Format["RecordImageMap"]) ? $Format["RecordImageMap"] : false;

        $this->LastChartLayout = CHART_LAST_LAYOUT_REGULAR;

        $Data = $this->DataSet->getData();
        list($XMargin, $XDivs) = $this->scaleGetXSettings();

        foreach ($Data["Series"] as $SerieName => $Serie) {
            if ($Serie["isDrawable"] == true && $SerieName != $Data["Abscissa"]) {
                if (isset($Serie["Weight"])) {
                    $SerieWeight = $Serie["Weight"] + 2;
                } else {
                    $SerieWeight = 2;
                }
                if ($PlotSize != null) {
                    $SerieWeight = $PlotSize;
                }

                $R = $Serie["Color"]["R"];
                $G = $Serie["Color"]["G"];
                $B = $Serie["Color"]["B"];
                $Alpha = (int) $Serie["Color"]["Alpha"];
                $Ticks = $Serie["Ticks"];
                if ($Surrounding != null) {
                    $BorderR = $R + $Surrounding;
                    $BorderG = $G + $Surrounding;
                    $BorderB = $B + $Surrounding;
                }
                if (isset($Serie["Picture"])) {
                    $Picture = $Serie["Picture"];
                    list($PicWidth, $PicHeight, $PicType) = $this->getPicInfo($Picture);
                } else {
                    $Picture = null;
                    $PicOffset = 0;
                }

                if ($DisplayColor == DISPLAY_AUTO) {
                    $DisplayR = $R;
                    $DisplayG = $G;
                    $DisplayB = $B;
                }

                $AxisID = $Serie["Axis"];
                $Shape = $Serie["Shape"];
                $Mode = $Data["Axis"][$AxisID]["Display"];
                $Format = $Data["Axis"][$AxisID]["Format"];
                $Unit = $Data["Axis"][$AxisID]["Unit"];

                if (isset($Serie["Description"])) {
                    $SerieDescription = $Serie["Description"];
                } else {
                    $SerieDescription = $SerieName;
                }

                $PosArray = $this->scaleComputeY($Serie["Data"], ["AxisID" => $Serie["Axis"]]);

                $this->DataSet->Data["Series"][$SerieName]["XOffset"] = 0;

                if ($Data["Orientation"] == SCALE_POS_LEFTRIGHT) {
                    if ($XDivs == 0) {
                        $XStep = ($this->GraphAreaX2 - $this->GraphAreaX1) / 4;
                    } else {
                        $XStep = ($this->GraphAreaX2 - $this->GraphAreaX1 - $XMargin * 2) / $XDivs;
                    }
                    if ($Picture != null) {
                        $PicOffset = $PicHeight / 2;
                        $SerieWeight = 0;
                    }
                    $X = $this->GraphAreaX1 + $XMargin;

                    if (!is_array($PosArray)) {
                        $Value = $PosArray;
                        $PosArray = [];
                        $PosArray[0] = $Value;
                    }
                    foreach ($PosArray as $Key => $Y) {
                        if ($DisplayValues) {
                            $this->drawText(
                                $X,
                                $Y - $DisplayOffset - $SerieWeight - $BorderSize - $PicOffset,
                                $this->scaleFormat($Serie["Data"][$Key], $Mode, $Format, $Unit),
                                [
                                    "R" => $DisplayR,
                                    "G" => $DisplayG,
                                    "B" => $DisplayB,
                                    "Align" => TEXT_ALIGN_BOTTOMMIDDLE
                                ]
                            );
                        }
                        if ($Y != VOID) {
                            if ($RecordImageMap) {
                                $this->addToImageMap(
                                    "CIRCLE",
                                    floor($X) . "," . floor($Y) . "," . $SerieWeight,
                                    $this->toHTMLColor($R, $G, $B),
                                    $SerieDescription,
                                    $this->scaleFormat(
                                        $Serie["Data"][$Key],
                                        $Mode,
                                        $Format,
                                        $Unit
                                    )
                                );
                            }

                            if ($Picture != null) {
                                $this->drawFromPicture(
                                    $PicType,
                                    $Picture,
                                    $X - $PicWidth / 2,
                                    $Y - $PicHeight / 2
                                );
                            } else {
                                $this->drawShape(
                                    $X,
                                    $Y,
                                    $Shape,
                                    $SerieWeight,
                                    $PlotBorder,
                                    $BorderSize,
                                    $R,
                                    $G,
                                    $B,
                                    $Alpha,
                                    $BorderR,
                                    $BorderG,
                                    $BorderB,
                                    $BorderAlpha
                                );
                            }
                        }
                        $X = $X + $XStep;
                    }
                } else {
                    if ($XDivs == 0) {
                        $YStep = ($this->GraphAreaY2 - $this->GraphAreaY1) / 4;
                    } else {
                        $YStep = ($this->GraphAreaY2 - $this->GraphAreaY1 - $XMargin * 2) / $XDivs;
                    }
                    if ($Picture != null) {
                        $PicOffset = $PicWidth / 2;
                        $SerieWeight = 0;
                    }
                    $Y = $this->GraphAreaY1 + $XMargin;

                    if (!is_array($PosArray)) {
                        $Value = $PosArray;
                        $PosArray = [];
                        $PosArray[0] = $Value;
                    }
                    foreach ($PosArray as $Key => $X) {
                        if ($DisplayValues) {
                            $this->drawText(
                                $X + $DisplayOffset + $SerieWeight + $BorderSize + $PicOffset,
                                $Y,
                                $this->scaleFormat($Serie["Data"][$Key], $Mode, $Format, $Unit),
                                [
                                    "Angle" => 270,
                                    "R" => $DisplayR,
                                    "G" => $DisplayG,
                                    "B" => $DisplayB,
                                    "Align" => TEXT_ALIGN_BOTTOMMIDDLE
                                ]
                            );
                        }
                        if ($X != VOID) {
                            if ($RecordImageMap) {
                                $this->addToImageMap(
                                    "CIRCLE",
                                    floor($X) . "," . floor($Y) . "," . $SerieWeight,
                                    $this->toHTMLColor($R, $G, $B),
                                    $SerieDescription,
                                    $this->scaleFormat($Serie["Data"][$Key], $Mode, $Format, $Unit)
                                );
                            }

                            if ($Picture != null) {
                                $this->drawFromPicture(
                                    $PicType,
                                    $Picture,
                                    $X - $PicWidth / 2,
                                    $Y - $PicHeight / 2
                                );
                            } else {
                                $this->drawShape(
                                    $X,
                                    $Y,
                                    $Shape,
                                    $SerieWeight,
                                    $PlotBorder,
                                    $BorderSize,
                                    $R,
                                    $G,
                                    $B,
                                    $Alpha,
                                    $BorderR,
                                    $BorderG,
                                    $BorderB,
                                    $BorderAlpha
                                );
                            }
                        }
                        $Y = $Y + $YStep;
                    }
                }
            }
        }
    }
597571
public function drawScatterThresholdArea($Value1, $Value2, array $Format = [])
    {
        $AxisID = isset($Format["AxisID"]) ? $Format["AxisID"] : 0;
        $R = isset($Format["R"]) ? $Format["R"] : 255;
        $G = isset($Format["G"]) ? $Format["G"] : 0;
        $B = isset($Format["B"]) ? $Format["B"] : 0;
        $Alpha = isset($Format["Alpha"]) ? $Format["Alpha"] : 20;
        $Border = isset($Format["Border"]) ? $Format["Border"] : true;
        $BorderR = isset($Format["BorderR"]) ? $Format["BorderR"] : $R;
        $BorderG = isset($Format["BorderG"]) ? $Format["BorderG"] : $G;
        $BorderB = isset($Format["BorderB"]) ? $Format["BorderB"] : $B;
        $BorderAlpha = isset($Format["BorderAlpha"]) ? $Format["BorderAlpha"] : $Alpha + 20;
        $BorderTicks = isset($Format["BorderTicks"]) ? $Format["BorderTicks"] : 2;
        $AreaName = isset($Format["AreaName"]) ? $Format["AreaName"] : "La ouate de phoque"; //null;
        $NameAngle = isset($Format["NameAngle"]) ? $Format["NameAngle"] : ZONE_NAME_ANGLE_AUTO;
        $NameR = isset($Format["NameR"]) ? $Format["NameR"] : 255;
        $NameG = isset($Format["NameG"]) ? $Format["NameG"] : 255;
        $NameB = isset($Format["NameB"]) ? $Format["NameB"] : 255;
        $NameAlpha = isset($Format["NameAlpha"]) ? $Format["NameAlpha"] : 100;
        $DisableShadowOnArea = isset($Format["DisableShadowOnArea"]) ? $Format["DisableShadowOnArea"] : true;

        if ($Value1 > $Value2) {
            list($Value1, $Value2) = [$Value2, $Value1];
        }

        $RestoreShadow = $this->pChartObject->Shadow;
        if ($DisableShadowOnArea && $this->pChartObject->Shadow) {
            $this->pChartObject->Shadow = false;
        }

        if ($BorderAlpha > 100) {
            $BorderAlpha = 100;
        }

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

        if (!isset($Data["Axis"][$AxisID])) {
            return -1;
        }

        if ($Data["Axis"][$AxisID]["Identity"] == AXIS_X) {
            $Y1 = $this->pChartObject->GraphAreaY1 + $Data["Axis"][$AxisID]["Margin"];
            $Y2 = $this->pChartObject->GraphAreaY2 - $Data["Axis"][$AxisID]["Margin"];
            $X1 = $this->getPosArray($Value1, $AxisID);
            $X2 = $this->getPosArray($Value2, $AxisID);

            if ($X1 <= $this->pChartObject->GraphAreaX1) {
                $X1 = $this->pChartObject->GraphAreaX1 + $Data["Axis"][$AxisID]["Margin"];
            }
            if ($X2 >= $this->pChartObject->GraphAreaX2) {
                $X2 = $this->pChartObject->GraphAreaX2 - $Data["Axis"][$AxisID]["Margin"];
            }

            $this->pChartObject->drawFilledRectangle(
                $X1,
                $Y1,
                $X2,
                $Y2,
                ["R" => $R, "G" => $G, "B" => $B, "Alpha" => $Alpha]
            );

            if ($Border) {
                $this->pChartObject->drawLine(
                    $X1,
                    $Y1,
                    $X1,
                    $Y2,
                    [
                        "R" => $BorderR,
                        "G" => $BorderG,
                        "B" => $BorderB,
                        "Alpha" => $BorderAlpha,
                        "Ticks" => $BorderTicks
                    ]
                );
                $this->pChartObject->drawLine(
                    $X2,
                    $Y1,
                    $X2,
                    $Y2,
                    [
                        "R" => $BorderR,
                        "G" => $BorderG,
                        "B" => $BorderB,
                        "Alpha" => $BorderAlpha,
                        "Ticks" => $BorderTicks
                    ]
                );
            }

            if ($AreaName != null) {
                $XPos = ($X2 - $X1) / 2 + $X1;
                $YPos = ($Y2 - $Y1) / 2 + $Y1;

                if ($NameAngle == ZONE_NAME_ANGLE_AUTO) {
                    $TxtPos = $this->pChartObject->getTextBox(
                        $XPos,
                        $YPos,
                        $this->pChartObject->FontName,
                        $this->pChartObject->FontSize,
                        0,
                        $AreaName
                    );
                    $TxtWidth = $TxtPos[1]["X"] - $TxtPos[0]["X"];
                    if (abs($X2 - $X1) > $TxtWidth) {
                        $NameAngle = 0;
                    } else {
                        $NameAngle = 90;
                    }
                }
                $this->pChartObject->Shadow = $RestoreShadow;
                $this->pChartObject->drawText(
                    $XPos,
                    $YPos,
                    $AreaName,
                    [
                        "R" => $NameR,
                        "G" => $NameG,
                        "B" => $NameB,
                        "Alpha" => $NameAlpha,
                        "Angle" => $NameAngle,
                        "Align" => TEXT_ALIGN_MIDDLEMIDDLE
                    ]
                );
                if ($DisableShadowOnArea) {
                    $this->pChartObject->Shadow = false;
                }
            }

            $this->pChartObject->Shadow = $RestoreShadow;
            return ["X1" => $X1, "X2" => $X2];
        } elseif ($Data["Axis"][$AxisID]["Identity"] == AXIS_Y) {
            $X1 = $this->pChartObject->GraphAreaX1 + $Data["Axis"][$AxisID]["Margin"];
            $X2 = $this->pChartObject->GraphAreaX2 - $Data["Axis"][$AxisID]["Margin"];
            $Y1 = $this->getPosArray($Value1, $AxisID);
            $Y2 = $this->getPosArray($Value2, $AxisID);

            if ($Y1 >= $this->pChartObject->GraphAreaY2) {
                $Y1 = $this->pChartObject->GraphAreaY2 - $Data["Axis"][$AxisID]["Margin"];
            }
            if ($Y2 <= $this->pChartObject->GraphAreaY1) {
                $Y2 = $this->pChartObject->GraphAreaY1 + $Data["Axis"][$AxisID]["Margin"];
            }

            $this->pChartObject->drawFilledRectangle(
                $X1,
                $Y1,
                $X2,
                $Y2,
                ["R" => $R, "G" => $G, "B" => $B, "Alpha" => $Alpha]
            );

            if ($Border) {
                $this->pChartObject->drawLine(
                    $X1,
                    $Y1,
                    $X2,
                    $Y1,
                    [
                        "R" => $BorderR,
                        "G" => $BorderG,
                        "B" => $BorderB,
                        "Alpha" => $BorderAlpha,
                        "Ticks" => $BorderTicks
                    ]
                );
                $this->pChartObject->drawLine(
                    $X1,
                    $Y2,
                    $X2,
                    $Y2,
                    [
                        "R" => $BorderR,
                        "G" => $BorderG,
                        "B" => $BorderB,
                        "Alpha" => $BorderAlpha,
                        "Ticks" => $BorderTicks
                    ]
                );
            }

            if ($AreaName != null) {
                $XPos = ($X2 - $X1) / 2 + $X1;
                $YPos = ($Y2 - $Y1) / 2 + $Y1;

                $this->pChartObject->Shadow = $RestoreShadow;
                $this->pChartObject->drawText(
                    $YPos,
                    $XPos,
                    $AreaName,
                    [
                        "R" => $NameR,
                        "G" => $NameG,
                        "B" => $NameB,
                        "Alpha" => $NameAlpha,
                        "Angle" => 0,
                        "Align" => TEXT_ALIGN_MIDDLEMIDDLE
                    ]
                );
                if ($DisableShadowOnArea) {
                    $this->Shadow = false;
                }
            }

            $this->pChartObject->Shadow = $RestoreShadow;
            return ["Y1" => $Y1, "Y2" => $Y2];
        }
    }
646016
public function writeXLabels(array $Format = [])
    {
        $R = isset($Format["R"]) ? $Format["R"] : $this->pChartObject->FontColorR;
        $G = isset($Format["G"]) ? $Format["G"] : $this->pChartObject->FontColorG;
        $B = isset($Format["B"]) ? $Format["B"] : $this->pChartObject->FontColorB;
        $Alpha = isset($Format["Alpha"]) ? $Format["Alpha"] : $this->pChartObject->FontColorA;
        $Angle = isset($Format["Angle"]) ? $Format["Angle"] : 0;
        $Padding = isset($Format["Padding"]) ? $Format["Padding"] : 5;
        $Position = isset($Format["Position"]) ? $Format["Position"] : LABEL_POSITION_TOP;
        $Labels = isset($Format["Labels"]) ? $Format["Labels"] : null;
        $CountOffset = isset($Format["CountOffset"]) ? $Format["CountOffset"] : 0;

        if ($Labels != null && !is_array($Labels)) {
            $Label = $Labels;
            $Labels = [$Label];
        }

        $X0 = $this->pChartObject->GraphAreaX1;
        $XSize = ($this->pChartObject->GraphAreaX2 - $this->pChartObject->GraphAreaX1) / ($this->GridSizeX + 1);

        $Settings = ["Angle" => $Angle, "R" => $R, "G" => $G, "B" => $B, "Alpha" => $Alpha];
        if ($Position == LABEL_POSITION_TOP) {
            $YPos = $this->pChartObject->GraphAreaY1 - $Padding;
            if ($Angle == 0) {
                $Settings["Align"] = TEXT_ALIGN_BOTTOMMIDDLE;
            }
            if ($Angle != 0) {
                $Settings["Align"] = TEXT_ALIGN_MIDDLELEFT;
            }
        } elseif ($Position == LABEL_POSITION_BOTTOM) {
            $YPos = $this->pChartObject->GraphAreaY2 + $Padding;
            if ($Angle == 0) {
                $Settings["Align"] = TEXT_ALIGN_TOPMIDDLE;
            }
            if ($Angle != 0) {
                $Settings["Align"] = TEXT_ALIGN_MIDDLERIGHT;
            }
        } else {
            return -1;
        }
        for ($X = 0; $X <= $this->GridSizeX; $X++) {
            $XPos = floor($X0 + $X * $XSize + $XSize / 2);

            if ($Labels == null || !isset($Labels[$X])) {
                $Value = $X + $CountOffset;
            } else {
                $Value = $Labels[$X];
            }
            $this->pChartObject->drawText($XPos, $YPos, $Value, $Settings);
        }
    }
921974
public static function printf(string $format, ...$args): int
    {
        return self::write(\sprintf($format, ...$args));
    }
768460
public function show($type = null, $format = null)
    {
        $messages = $this->getMessagesForRender($type);

        $this->groupForRender = array();

        $output = '';

        foreach ($messages as $message) {
            if (!$message->isFlash()) {
                if (!is_null($format)) {
                    $message->setFormat($format);
                }

                $output .= $message->render();
            }
        }

        return $output;
    }
461710
public function drawContour($Threshold, array $Format = [])
    {
        $R = isset($Format["R"]) ? $Format["R"] : 0;
        $G = isset($Format["G"]) ? $Format["G"] : 0;
        $B = isset($Format["B"]) ? $Format["B"] : 0;
        $Alpha = isset($Format["Alpha"]) ? $Format["Alpha"] : 100;
        $Ticks = isset($Format["Ticks"]) ? $Format["Ticks"] : 3;
        $Padding = isset($Format["Padding"]) ? $Format["Padding"] : 0;

        $X0 = $this->pChartObject->GraphAreaX1;
        $Y0 = $this->pChartObject->GraphAreaY1;
        $XSize = ($this->pChartObject->GraphAreaX2 - $this->pChartObject->GraphAreaX1) / ($this->GridSizeX + 1);
        $YSize = ($this->pChartObject->GraphAreaY2 - $this->pChartObject->GraphAreaY1) / ($this->GridSizeY + 1);

        $Color = ["R" => $R, "G" => $G, "B" => $B, "Alpha" => $Alpha, "Ticks" => $Ticks];

        for ($X = 0; $X <= $this->GridSizeX; $X++) {
            for ($Y = 0; $Y <= $this->GridSizeY; $Y++) {
                $Value = $this->Points[$X][$Y];

                if ($Value != UNKNOWN && $Value != IGNORED && $Value >= $Threshold) {
                    $X1 = floor($X0 + $X * $XSize) + $Padding;
                    $Y1 = floor($Y0 + $Y * $YSize) + $Padding;
                    $X2 = floor($X0 + $X * $XSize + $XSize);
                    $Y2 = floor($Y0 + $Y * $YSize + $YSize);

                    if ($X > 0 && $this->Points[$X - 1][$Y] != UNKNOWN
                        && $this->Points[$X - 1][$Y] != IGNORED
                        && $this->Points[$X - 1][$Y] < $Threshold
                    ) {
                        $this->pChartObject->drawLine($X1, $Y1, $X1, $Y2, $Color);
                    }
                    if ($Y > 0 && $this->Points[$X][$Y - 1] != UNKNOWN
                        && $this->Points[$X][$Y - 1] != IGNORED
                        && $this->Points[$X][$Y - 1] < $Threshold
                    ) {
                        $this->pChartObject->drawLine($X1, $Y1, $X2, $Y1, $Color);
                    }
                    if ($X < $this->GridSizeX
                        && $this->Points[$X + 1][$Y] != UNKNOWN
                        && $this->Points[$X + 1][$Y] != IGNORED
                        && $this->Points[$X + 1][$Y] < $Threshold
                    ) {
                        $this->pChartObject->drawLine($X2, $Y1, $X2, $Y2, $Color);
                    }
                    if ($Y < $this->GridSizeY
                        && $this->Points[$X][$Y + 1] != UNKNOWN
                        && $this->Points[$X][$Y + 1] != IGNORED
                        && $this->Points[$X][$Y + 1] < $Threshold
                    ) {
                        $this->pChartObject->drawLine($X1, $Y2, $X2, $Y2, $Color);
                    }
                }
            }
        }
    }
910384
public function setXAxisDisplay($Mode, $Format = null)
    {
        $this->Data["XAxisDisplay"] = $Mode;
        $this->Data["XAxisFormat"] = $Format;
    }
283579
public function drawScatterPlotChart($Format = null)
    {
        $PlotSize = isset($Format["PlotSize"]) ? $Format["PlotSize"] : 3;
        $PlotBorder = isset($Format["PlotBorder"]) ? $Format["PlotBorder"] : false;
        $BorderR = isset($Format["BorderR"]) ? $Format["BorderR"] : 250;
        $BorderG = isset($Format["BorderG"]) ? $Format["BorderG"] : 250;
        $BorderB = isset($Format["BorderB"]) ? $Format["BorderB"] : 250;
        $BorderAlpha = isset($Format["BorderAlpha"]) ? $Format["BorderAlpha"] : 30;
        $BorderSize = isset($Format["BorderSize"]) ? $Format["BorderSize"] : 1;
        $RecordImageMap = isset($Format["RecordImageMap"]) ? $Format["RecordImageMap"] : false;
        $ImageMapTitle = isset($Format["ImageMapTitle"]) ? $Format["ImageMapTitle"] : null;

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

        $BorderColor = ["R" => $BorderR, "G" => $BorderG, "B" => $BorderB, "Alpha" => $BorderAlpha];

        foreach ($Data["ScatterSeries"] as $Key => $Series) {
            if ($Series["isDrawable"] == true) {
                $SerieX = $Series["X"];
                $SerieValuesX = $Data["Series"][$SerieX]["Data"];
                $SerieXAxis = $Data["Series"][$SerieX]["Axis"];
                $SerieY = $Series["Y"];
                $SerieValuesY = $Data["Series"][$SerieY]["Data"];
                $SerieYAxis = $Data["Series"][$SerieY]["Axis"];

                if ($ImageMapTitle == null) {
                    $Description = sprintf(
                        "%s / %s",
                        $Data["Series"][$Series["X"]]["Description"],
                        $Data["Series"][$Series["Y"]]["Description"]
                    );
                } else {
                    $Description = $ImageMapTitle;
                }

                if (isset($Series["Picture"]) && $Series["Picture"] != "") {
                    $Picture = $Series["Picture"];
                    list($PicWidth, $PicHeight, $PicType) = $this->pChartObject->getPicInfo($Picture);
                } else {
                    $Picture = null;
                }

                $PosArrayX = $this->getPosArray($SerieValuesX, $SerieXAxis);
                if (!is_array($PosArrayX)) {
                    $Value = $PosArrayX;
                    $PosArrayX = [];
                    $PosArrayX[0] = $Value;
                }
                $PosArrayY = $this->getPosArray($SerieValuesY, $SerieYAxis);
                if (!is_array($PosArrayY)) {
                    $Value = $PosArrayY;
                    $PosArrayY = [];
                    $PosArrayY[0] = $Value;
                }

                $Color = [
                    "R" => $Series["Color"]["R"],
                    "G" => $Series["Color"]["G"],
                    "B" => $Series["Color"]["B"],
                    "Alpha" => $Series["Color"]["Alpha"]
                ];

                foreach ($PosArrayX as $Key => $Value) {
                    $X = $Value;
                    $Y = $PosArrayY[$Key];

                    if ($X != VOID && $Y != VOID) {
                        $RealValue = sprintf(
                            "%s / %s",
                            round($Data["Series"][$Series["X"]]["Data"][$Key], 2),
                            round($Data["Series"][$Series["Y"]]["Data"][$Key], 2)
                        );
                        if ($RecordImageMap) {
                            $this->pChartObject->addToImageMap(
                                "CIRCLE",
                                sprintf(
                                    "%s,%s,%s",
                                    floor($X),
                                    floor($Y),
                                    floor($PlotSize + $BorderSize)
                                ),
                                $this->pChartObject->toHTMLColor(
                                    $Series["Color"]["R"],
                                    $Series["Color"]["G"],
                                    $Series["Color"]["B"]
                                ),
                                $Description,
                                $RealValue
                            );
                        }

                        if (isset($Series["Shape"])) {
                            $this->pChartObject->drawShape(
                                $X,
                                $Y,
                                $Series["Shape"],
                                $PlotSize,
                                $PlotBorder,
                                $BorderSize,
                                $Series["Color"]["R"],
                                $Series["Color"]["G"],
                                $Series["Color"]["B"],
                                $Series["Color"]["Alpha"],
                                $BorderR,
                                $BorderG,
                                $BorderB,
                                $BorderAlpha
                            );
                        } elseif ($Picture == null) {
                            if ($PlotBorder) {
                                $this->pChartObject->drawFilledCircle(
                                    $X,
                                    $Y,
                                    $PlotSize + $BorderSize,
                                    $BorderColor
                                );
                            }
                            $this->pChartObject->drawFilledCircle($X, $Y, $PlotSize, $Color);
                        } else {
                            $this->pChartObject->drawFromPicture(
                                $PicType,
                                $Picture,
                                $X - $PicWidth / 2,
                                $Y - $PicHeight / 2
                            );
                        }
                    }
                }
            }
        }
    }
719562
public function draw($target, $format = PlantUML::FORMAT_TXT, array $includes = [], array $excludes = [])
    {
        $this->files = [];
        $this->resolvedFiles = [];
        $this->excludes = $excludes;
        $this->includes = $includes;

        // List views
        $path = $this->kernel->getRootDir() . '/Resources/views';
        if ($this->fs->exists($path)) {
            /** @var SplFileInfo[] $appFiles */
            $appFiles = Finder::create()->files()->in($path)->depth('<5');
            foreach ($appFiles as $file) {
                $this->load($file);
            }
        }
        $bundles = $this->kernel->getBundles();
        foreach ($bundles as $bundle) {
            $path = $bundle->getPath() . '/Resources/views';
            if ($this->fs->exists($path)) {
                /** @var SplFileInfo[] $bundleFiles */
                $bundleFiles = Finder::create()->files()->in($path)->depth('<5');
                foreach ($bundleFiles as $file) {
                    $this->load($file, $bundle);
                }
            }
        }
        array_map([$this, 'resolve'], $this->files);

        // Create graph
        $g = new Graph();
        foreach ($this->resolvedFiles as $id => $file) {
            $box = $g->addBox($id);

            // Defined blocks
            if (0 !== count($file['defined_blocks']) || 0 !== count($file['called_blocks'])) {
                $box->addText('blocks');
                if (0 !== count($file['defined_blocks'])) {
                    $box->addText('defined', 1);
                    foreach ($file['defined_blocks'] as $block) {
                        $box->addText($block, 2);
                    }
                }
                if (0 !== count($file['called_blocks'])) {
                    $box->addText('called', 1);
                    foreach ($file['called_blocks'] as $block) {
                        $box->addText($block, 2);
                    }
                }
            }

            // Extends
            foreach ($file['extends'] as $extend) {
                $box->addExtends($extend['id']);
            }

            // Traits
            foreach ($file['uses'] as $use) {
                $box->addText(sprintf('use "%s"', $use['id']));
                if (!empty($use['defined_blocks'])) {
                    $box->addText('defined', 1);
                    foreach ($use['defined_blocks'] as $block) {
                        $box->addText($block, 2);
                    }
                }
                if (!empty($use['called_blocks'])) {
                    $box->addText('called', 1);
                    foreach ($use['called_blocks'] as $block) {
                        $box->addText($block, 2);
                    }
                }
            }

            // Includes
            foreach ($file['includes'] as $include) {
                $box->addText(sprintf('include "%s"', $include['id']));
            }
        }

        return $this->plantUML->dump($g, $target, $format);
    }
817179
protected function generateImage(string $format): string
    {
        $url = $this->generateUrl($format);

        $content = file_get_contents($url);

        if ($content === false) {
            $content = '';
        }

        return $content;
    }
603567
public function getGeolocatorDisplayDescription($format = 'html')
    {
        $value = tc('GeolocatorDescription', $this->getGeolocatorDescription());
        switch ($format) {
            case 'html':
                return nl2br(h($value));
            case 'text':
            default:
                return $value;
        }
    }
945875
public function generateUrl(string $format): string
    {
        switch ($format) {
            case self::FORMAT_EPS:
            case self::FORMAT_PNG:
            case self::FORMAT_SVG:
                break;
            default:
                throw new DiagramException(sprintf('Format "%s" not handled.', $format));
                break;
        }

        $puml    = $this->generatePuml();
        $encoded = encodep($puml);

        return sprintf(self::URL, $format, $encoded);
    }
365072
public function render($format = 'd.m.Y H:i:s') {
		$output = $this->getContext() . ': ';
	    $date = $this->extractDateFromRevisionFile();
	    if ($date === null) {
	        $date = $this->extractDateFromSurfPath();
        }
	    if ($date === null) {
	        $date = new \DateTime('now');
        }

	    $output.= $date->format($format);
	    $output.= $this->extractRevisionFileContent();

		return $output;
	}
34190
public function drawFilledRectangle($X1, $Y1, $X2, $Y2, array $Format = [])
    {
        $R = isset($Format["R"]) ? $Format["R"] : 0;
        $G = isset($Format["G"]) ? $Format["G"] : 0;
        $B = isset($Format["B"]) ? $Format["B"] : 0;
        $Alpha = isset($Format["Alpha"]) ? $Format["Alpha"] : 100;
        $BorderR = isset($Format["BorderR"]) ? $Format["BorderR"] : -1;
        $BorderG = isset($Format["BorderG"]) ? $Format["BorderG"] : -1;
        $BorderB = isset($Format["BorderB"]) ? $Format["BorderB"] : -1;
        $BorderAlpha = isset($Format["BorderAlpha"]) ? $Format["BorderAlpha"] : $Alpha;
        $Surrounding = isset($Format["Surrounding"]) ? $Format["Surrounding"] : null;
        $Ticks = isset($Format["Ticks"]) ? $Format["Ticks"] : null;
        $NoAngle = isset($Format["NoAngle"]) ? $Format["NoAngle"] : null;
        $Dash = isset($Format["Dash"]) ? $Format["Dash"] : false;
        $DashStep = isset($Format["DashStep"]) ? $Format["DashStep"] : 4;
        $DashR = isset($Format["DashR"]) ? $Format["DashR"] : 0;
        $DashG = isset($Format["DashG"]) ? $Format["DashG"] : 0;
        $DashB = isset($Format["DashB"]) ? $Format["DashB"] : 0;
        $NoBorder = isset($Format["NoBorder"]) ? $Format["NoBorder"] : false;

        if ($Surrounding != null) {
            $BorderR = $R + $Surrounding;
            $BorderG = $G + $Surrounding;
            $BorderB = $B + $Surrounding;
        }

        if ($X1 > $X2) {
            list($X1, $X2) = [$X2, $X1];
        }
        if ($Y1 > $Y2) {
            list($Y1, $Y2) = [$Y2, $Y1];
        }

        $RestoreShadow = $this->Shadow;
        if ($this->Shadow && $this->ShadowX != 0 && $this->ShadowY != 0) {
            $this->Shadow = false;
            $this->drawFilledRectangle(
                $X1 + $this->ShadowX,
                $Y1 + $this->ShadowY,
                $X2 + $this->ShadowX,
                $Y2 + $this->ShadowY,
                [
                    "R" => $this->ShadowR,
                    "G" => $this->ShadowG,
                    "B" => $this->ShadowB,
                    "Alpha" => $this->Shadowa,
                    "Ticks" => $Ticks,
                    "NoAngle" => $NoAngle
                ]
            );
        }

        $Color = $this->allocateColor($this->Picture, $R, $G, $B, $Alpha);
        if ($NoAngle) {
            imagefilledrectangle($this->Picture, ceil($X1) + 1, ceil($Y1), floor($X2) - 1, floor($Y2), $Color);
            imageline($this->Picture, ceil($X1), ceil($Y1) + 1, ceil($X1), floor($Y2) - 1, $Color);
            imageline($this->Picture, floor($X2), ceil($Y1) + 1, floor($X2), floor($Y2) - 1, $Color);
        } else {
            imagefilledrectangle($this->Picture, ceil($X1), ceil($Y1), floor($X2), floor($Y2), $Color);
        }
        if ($Dash) {
            if ($BorderR != -1) {
                $iX1 = $X1 + 1;
                $iY1 = $Y1 + 1;
                $iX2 = $X2 - 1;
                $iY2 = $Y2 - 1;
            } else {
                $iX1 = $X1;
                $iY1 = $Y1;
                $iX2 = $X2;
                $iY2 = $Y2;
            }

            $Color = $this->allocateColor($this->Picture, $DashR, $DashG, $DashB, $Alpha);
            $Y = $iY1 - $DashStep;
            for ($X = $iX1; $X <= $iX2 + ($iY2 - $iY1); $X = $X + $DashStep) {
                $Y = $Y + $DashStep;
                if ($X > $iX2) {
                    $Xa = $X - ($X - $iX2);
                    $Ya = $iY1 + ($X - $iX2);
                } else {
                    $Xa = $X;
                    $Ya = $iY1;
                }
                if ($Y > $iY2) {
                    $Xb = $iX1 + ($Y - $iY2);
                    $Yb = $Y - ($Y - $iY2);
                } else {
                    $Xb = $iX1;
                    $Yb = $Y;
                }
                imageline($this->Picture, $Xa, $Ya, $Xb, $Yb, $Color);
            }
        }

        if ($this->Antialias && !$NoBorder) {
            if ($X1 < ceil($X1)) {
                $AlphaA = $Alpha * (ceil($X1) - $X1);
                $Color = $this->allocateColor($this->Picture, $R, $G, $B, $AlphaA);
                imageline($this->Picture, ceil($X1) - 1, ceil($Y1), ceil($X1) - 1, floor($Y2), $Color);
            }

            if ($Y1 < ceil($Y1)) {
                $AlphaA = $Alpha * (ceil($Y1) - $Y1);
                $Color = $this->allocateColor($this->Picture, $R, $G, $B, $AlphaA);
                imageline($this->Picture, ceil($X1), ceil($Y1) - 1, floor($X2), ceil($Y1) - 1, $Color);
            }

            if ($X2 > floor($X2)) {
                $AlphaA = $Alpha * (.5 - ($X2 - floor($X2)));
                $Color = $this->allocateColor($this->Picture, $R, $G, $B, $AlphaA);
                imageline($this->Picture, floor($X2) + 1, ceil($Y1), floor($X2) + 1, floor($Y2), $Color);
            }

            if ($Y2 > floor($Y2)) {
                $AlphaA = $Alpha * (.5 - ($Y2 - floor($Y2)));
                $Color = $this->allocateColor($this->Picture, $R, $G, $B, $AlphaA);
                imageline($this->Picture, ceil($X1), floor($Y2) + 1, floor($X2), floor($Y2) + 1, $Color);
            }
        }

        if ($BorderR != -1) {
            $this->drawRectangle(
                $X1,
                $Y1,
                $X2,
                $Y2,
                [
                    "R" => $BorderR,
                    "G" => $BorderG,
                    "B" => $BorderB,
                    "Alpha" => $BorderAlpha,
                    "Ticks" => $Ticks,
                    "NoAngle" => $NoAngle
                ]
            );
        }
        $this->Shadow = $RestoreShadow;
    }
685346
public function drawRectangleMarker($X, $Y, array $Format = [])
    {
        $Size = isset($Format["Size"]) ? $Format["Size"] : 4;

        $HalfSize = floor($Size / 2);
        $this->drawFilledRectangle($X - $HalfSize, $Y - $HalfSize, $X + $HalfSize, $Y + $HalfSize, $Format);
    }
1026730
public function drawScatterBestFit(array $Format = [])
    {
        $Ticks = isset($Format["Ticks"]) ? $Format["Ticks"] : 0;

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

        foreach ($Data["ScatterSeries"] as $Key => $Series) {
            if ($Series["isDrawable"] == true) {
                $SerieX = $Series["X"];
                $SerieXAxis = $Data["Series"][$SerieX]["Axis"];
                $SerieY = $Series["Y"];
                $SerieYAxis = $Data["Series"][$SerieY]["Axis"];

                $Color = [
                    "R" => $Series["Color"]["R"],
                    "G" => $Series["Color"]["G"],
                    "B" => $Series["Color"]["B"],
                    "Alpha" => $Series["Color"]["Alpha"]
                ];
                $Color["Ticks"] = $Ticks;

                $PosArrayX = $Data["Series"][$Series["X"]]["Data"];
                $PosArrayY = $Data["Series"][$Series["Y"]]["Data"];

                $Sxy = 0;
                $Sx = 0;
                $Sy = 0;
                $Sxx = 0;
                foreach ($PosArrayX as $Key => $Value) {
                    $X = $Value;
                    $Y = $PosArrayY[$Key];

                    $Sxy = $Sxy + $X * $Y;
                    $Sx = $Sx + $X;
                    $Sy = $Sy + $Y;
                    $Sxx = $Sxx + $X * $X;
                }

                $n = count($PosArrayX);

                if ((($n * $Sxx) == ($Sx * $Sx))) {
                    $X1 = $this->getPosArray($Data["Axis"][$SerieXAxis]["ScaleMin"], $SerieXAxis);
                    $X2 = $X1;
                    $Y1 = $this->pChartObject->GraphAreaY1;
                    $Y2 = $this->pChartObject->GraphAreaY2;
                } else {
                    $M = (($n * $Sxy) - ($Sx * $Sy)) / (($n * $Sxx) - ($Sx * $Sx));
                    $B = (($Sy) - ($M * $Sx)) / ($n);

                    $X1 = $this->getPosArray($Data["Axis"][$SerieXAxis]["ScaleMin"], $SerieXAxis);
                    $Y1 = $this->getPosArray($M * $Data["Axis"][$SerieXAxis]["ScaleMin"] + $B, $SerieYAxis);
                    $X2 = $this->getPosArray($Data["Axis"][$SerieXAxis]["ScaleMax"], $SerieXAxis);
                    $Y2 = $this->getPosArray($M * $Data["Axis"][$SerieXAxis]["ScaleMax"] + $B, $SerieYAxis);

                    $RealM = -($Y2 - $Y1) / ($X2 - $X1);

                    if ($Y1 < $this->pChartObject->GraphAreaY1) {
                        $X1 = $X1 + ($this->pChartObject->GraphAreaY1 - $Y1 / $RealM);
                        $Y1 = $this->pChartObject->GraphAreaY1;
                    }
                    if ($Y1 > $this->pChartObject->GraphAreaY2) {
                        $X1 = $X1 + ($Y1 - $this->pChartObject->GraphAreaY2) / $RealM;
                        $Y1 = $this->pChartObject->GraphAreaY2;
                    }
                    if ($Y2 < $this->pChartObject->GraphAreaY1) {
                        $X2 = $X2 - ($this->pChartObject->GraphAreaY1 - $Y2) / $RealM;
                        $Y2 = $this->pChartObject->GraphAreaY1;
                    }
                    if ($Y2 > $this->pChartObject->GraphAreaY2) {
                        $X2 = $X2 - ($Y2 - $this->pChartObject->GraphAreaY2) / $RealM;
                        $Y2 = $this->pChartObject->GraphAreaY2;
                    }
                }

                $this->pChartObject->drawLine($X1, $Y1, $X2, $Y2, $Color);
            }
        }
    }
865888
public function render($format = null)
    {
        if ( ! is_null($format) )
            $this->setFormat($format);

        $this->setHeaderResponse();
        call_user_func($this->getFunctionName(), $this->getImage());
    }