function pScatter::drawScatterLineChart in Visitors 7
Same name and namespace in other branches
- 7.2 pChart/class/pScatter.class.php \pScatter::drawScatterLineChart()
File
- pChart/
class/ pScatter.class.php, line 445
Class
Code
function drawScatterLineChart($Format = NULL) {
$Data = $this->pDataObject
->getData();
$Palette = $this->pDataObject
->getPalette();
$RecordImageMap = isset($Format["RecordImageMap"]) ? $Format["RecordImageMap"] : FALSE;
$ImageMapTitle = isset($Format["ImageMapTitle"]) ? $Format["ImageMapTitle"] : NULL;
$ImageMapPlotSize = isset($Format["ImageMapPlotSize"]) ? $Format["ImageMapPlotSize"] : 10;
$ImageMapPrecision = isset($Format["ImageMapPrecision"]) ? $Format["ImageMapPrecision"] : 2;
/* Parse all the series to draw */
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"];
$Ticks = $Series["Ticks"];
$Weight = $Series["Weight"];
if ($ImageMapTitle == NULL) {
$Description = $Data["Series"][$Series["X"]]["Description"] . " / " . $Data["Series"][$Series["Y"]]["Description"];
}
else {
$Description = $ImageMapTitle;
}
$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 = array(
"R" => $Series["Color"]["R"],
"G" => $Series["Color"]["G"],
"B" => $Series["Color"]["B"],
"Alpha" => $Series["Color"]["Alpha"],
);
if ($Ticks != 0) {
$Color["Ticks"] = $Ticks;
}
if ($Weight != 0) {
$Color["Weight"] = $Weight;
}
$LastX = VOID;
$LastY = VOID;
foreach ($PosArrayX as $Key => $Value) {
$X = $Value;
$Y = $PosArrayY[$Key];
if ($X != VOID && $Y != VOID) {
$RealValue = round($Data["Series"][$Series["X"]]["Data"][$Key], 2) . " / " . round($Data["Series"][$Series["Y"]]["Data"][$Key], 2);
if ($RecordImageMap) {
$this->pChartObject
->addToImageMap("CIRCLE", floor($X) . "," . floor($Y) . "," . $ImageMapPlotSize, $this->pChartObject
->toHTMLColor($Series["Color"]["R"], $Series["Color"]["G"], $Series["Color"]["B"]), $Description, $RealValue);
}
}
if ($X != VOID && $Y != VOID && $LastX != VOID && $LastY != VOID) {
$this->pChartObject
->drawLine($LastX, $LastY, $X, $Y, $Color);
}
$LastX = $X;
$LastY = $Y;
}
}
}
}