function pScatter::drawScatterSplineChart in Visitors 7.2
Same name and namespace in other branches
- 7 pChart/class/pScatter.class.php \pScatter::drawScatterSplineChart()
File
- pChart/
class/ pScatter.class.php, line 496
Class
Code
function drawScatterSplineChart($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;
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;
}
$SplineSettings = array(
"R" => $Series["Color"]["R"],
"G" => $Series["Color"]["G"],
"B" => $Series["Color"]["B"],
"Alpha" => $Series["Color"]["Alpha"],
);
if ($Ticks != 0) {
$SplineSettings["Ticks"] = $Ticks;
}
if ($Weight != 0) {
$SplineSettings["Weight"] = $Weight;
}
$LastX = VOID;
$LastY = VOID;
$WayPoints = "";
$Forces = "";
foreach ($PosArrayX as $Key => $Value) {
$X = $Value;
$Y = $PosArrayY[$Key];
$Force = $this->pChartObject
->getLength($LastX, $LastY, $X, $Y) / 5;
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) {
$WayPoints[] = array(
$X,
$Y,
);
$Forces[] = $Force;
}
if ($Y == VOID || $X == VOID) {
$SplineSettings["Forces"] = $Forces;
$this->pChartObject
->drawSpline($WayPoints, $SplineSettings);
$WayPoints = "";
$Forces = "";
}
$LastX = $X;
$LastY = $Y;
}
$SplineSettings["Forces"] = $Forces;
$this->pChartObject
->drawSpline($WayPoints, $SplineSettings);
}
}
}