1 |
efrain |
1 |
<?php
|
|
|
2 |
/*
|
|
|
3 |
pRadar - class to draw radar charts
|
|
|
4 |
|
|
|
5 |
Version : 2.1.4
|
|
|
6 |
Made by : Jean-Damien POGOLOTTI
|
|
|
7 |
Last Update : 19/01/2014
|
|
|
8 |
|
|
|
9 |
This file can be distributed under the license you can find at :
|
|
|
10 |
|
|
|
11 |
http://www.pchart.net/license
|
|
|
12 |
|
|
|
13 |
You can find the whole class documentation on the pChart web site.
|
|
|
14 |
*/
|
|
|
15 |
|
|
|
16 |
define("SEGMENT_HEIGHT_AUTO", 690001);
|
|
|
17 |
define("RADAR_LAYOUT_STAR", 690011);
|
|
|
18 |
define("RADAR_LAYOUT_CIRCLE", 690012);
|
|
|
19 |
define("RADAR_LABELS_ROTATED", 690021);
|
|
|
20 |
define("RADAR_LABELS_HORIZONTAL", 690022);
|
|
|
21 |
|
|
|
22 |
/* pRadar class definition */
|
|
|
23 |
class pRadar
|
|
|
24 |
{
|
|
|
25 |
var $pChartObject;
|
|
|
26 |
/* Class creator */
|
|
|
27 |
function __construct(){}
|
|
|
28 |
|
|
|
29 |
/* Draw a radar chart */
|
|
|
30 |
function drawRadar($Object, $Values, array $Format = [])
|
|
|
31 |
{
|
|
|
32 |
$this->pChartObject = $Object;
|
|
|
33 |
$FixedMax = VOID;
|
|
|
34 |
$AxisR = 60;
|
|
|
35 |
$AxisG = 60;
|
|
|
36 |
$AxisB = 60;
|
|
|
37 |
$AxisAlpha = 50;
|
|
|
38 |
$AxisRotation = 0;
|
|
|
39 |
$DrawTicks = TRUE;
|
|
|
40 |
$TicksLength = 2;
|
|
|
41 |
$DrawAxisValues = TRUE;
|
|
|
42 |
$AxisBoxRounded = TRUE;
|
|
|
43 |
$AxisFontName = $this->pChartObject->FontName;
|
|
|
44 |
$AxisFontSize = $this->pChartObject->FontSize;
|
|
|
45 |
$WriteValues = FALSE;
|
|
|
46 |
$WriteValuesInBubble = TRUE;
|
|
|
47 |
$ValueFontName = $this->pChartObject->FontName;
|
|
|
48 |
$ValueFontSize = $this->pChartObject->FontSize;
|
|
|
49 |
$ValuePadding = 4;
|
|
|
50 |
$OuterBubbleRadius = 2;
|
|
|
51 |
$OuterBubbleR = VOID;
|
|
|
52 |
$OuterBubbleG = VOID;
|
|
|
53 |
$OuterBubbleB = VOID;
|
|
|
54 |
$OuterBubbleAlpha = 100;
|
|
|
55 |
$InnerBubbleR = 255;
|
|
|
56 |
$InnerBubbleG = 255;
|
|
|
57 |
$InnerBubbleB = 255;
|
|
|
58 |
$InnerBubbleAlpha = 100;
|
|
|
59 |
$DrawBackground = TRUE;
|
|
|
60 |
$BackgroundR = 255;
|
|
|
61 |
$BackgroundG = 255;
|
|
|
62 |
$BackgroundB = 255;
|
|
|
63 |
$BackgroundAlpha = 50;
|
|
|
64 |
$BackgroundGradient = NULL;
|
|
|
65 |
$Layout = RADAR_LAYOUT_STAR;
|
|
|
66 |
$SegmentHeight = SEGMENT_HEIGHT_AUTO;
|
|
|
67 |
$Segments = 4;
|
|
|
68 |
$WriteLabels = TRUE;
|
|
|
69 |
$SkipLabels = 1;
|
|
|
70 |
$LabelMiddle = FALSE;
|
|
|
71 |
$LabelsBackground = TRUE;
|
|
|
72 |
$LabelsBGR = 255;
|
|
|
73 |
$LabelsBGG = 255;
|
|
|
74 |
$LabelsBGB = 255;
|
|
|
75 |
$LabelsBGAlpha = 50;
|
|
|
76 |
$LabelPos = RADAR_LABELS_ROTATED;
|
|
|
77 |
$LabelPadding = 4;
|
|
|
78 |
$DrawPoints = TRUE;
|
|
|
79 |
$PointRadius = 4;
|
|
|
80 |
$PointSurrounding = isset($Format["PointRadius"]) ? $Format["PointRadius"] : -30;
|
|
|
81 |
$DrawLines = TRUE;
|
|
|
82 |
$LineLoopStart = TRUE;
|
|
|
83 |
$DrawPoly = FALSE;
|
|
|
84 |
$PolyAlpha = 40;
|
|
|
85 |
$FontSize = $Object->FontSize;
|
|
|
86 |
$X1 = $Object->GraphAreaX1;
|
|
|
87 |
$Y1 = $Object->GraphAreaY1;
|
|
|
88 |
$X2 = $Object->GraphAreaX2;
|
|
|
89 |
$Y2 = $Object->GraphAreaY2;
|
|
|
90 |
$RecordImageMap = FALSE;
|
|
|
91 |
|
|
|
92 |
/* Override defaults */
|
|
|
93 |
extract($Format);
|
|
|
94 |
|
|
|
95 |
/* Cancel default tick length if ticks not enabled */
|
|
|
96 |
($DrawTicks == FALSE) AND $TicksLength = 0;
|
|
|
97 |
|
|
|
98 |
/* Data Processing */
|
|
|
99 |
$Data = $Values->getData();
|
|
|
100 |
$Palette = $Values->getPalette();
|
|
|
101 |
/* Catch the number of required axis */
|
|
|
102 |
$LabelSerie = $Data["Abscissa"];
|
|
|
103 |
if ($LabelSerie != "") {
|
|
|
104 |
$Points = count($Data["Series"][$LabelSerie]["Data"]);
|
|
|
105 |
} else {
|
|
|
106 |
$Points = 0;
|
|
|
107 |
foreach($Data["Series"] as $SerieName => $DataArray) {
|
|
|
108 |
if (count($DataArray["Data"]) > $Points) {
|
|
|
109 |
$Points = count($DataArray["Data"]);
|
|
|
110 |
}
|
|
|
111 |
}
|
|
|
112 |
}
|
|
|
113 |
|
|
|
114 |
/* Draw the axis */
|
|
|
115 |
$CenterX = ($X2 - $X1) / 2 + $X1;
|
|
|
116 |
$CenterY = ($Y2 - $Y1) / 2 + $Y1;
|
|
|
117 |
$EdgeHeight = min(($X2 - $X1) / 2, ($Y2 - $Y1) / 2);
|
|
|
118 |
if ($WriteLabels) {
|
|
|
119 |
$EdgeHeight = $EdgeHeight - $FontSize - $LabelPadding - $TicksLength;
|
|
|
120 |
}
|
|
|
121 |
|
|
|
122 |
/* Determine the scale if set to automatic */
|
|
|
123 |
if ($SegmentHeight == SEGMENT_HEIGHT_AUTO) {
|
|
|
124 |
if ($FixedMax != VOID) {
|
|
|
125 |
$Max = $FixedMax;
|
|
|
126 |
} else {
|
|
|
127 |
$Max = 0;
|
|
|
128 |
foreach($Data["Series"] as $SerieName => $DataArray) {
|
|
|
129 |
if ($SerieName != $LabelSerie) {
|
|
|
130 |
if (max($DataArray["Data"]) > $Max) {
|
|
|
131 |
$Max = max($DataArray["Data"]);
|
|
|
132 |
}
|
|
|
133 |
}
|
|
|
134 |
}
|
|
|
135 |
}
|
|
|
136 |
|
|
|
137 |
$MaxSegments = $EdgeHeight / 20;
|
|
|
138 |
$Scale = $Object->computeScale(0, $Max, $MaxSegments, [1,2,5]);
|
|
|
139 |
$Segments = $Scale["Rows"];
|
|
|
140 |
$SegmentHeight = $Scale["RowHeight"];
|
|
|
141 |
}
|
|
|
142 |
|
|
|
143 |
if ($LabelMiddle && $SkipLabels == 1) {
|
|
|
144 |
$Axisoffset = (360 / $Points) / 2;
|
|
|
145 |
} elseif ($LabelMiddle && $SkipLabels != 1) {
|
|
|
146 |
$Axisoffset = (360 / ($Points / $SkipLabels)) / 2;
|
|
|
147 |
} elseif (!$LabelMiddle) {
|
|
|
148 |
$Axisoffset = 0;
|
|
|
149 |
}
|
|
|
150 |
|
|
|
151 |
/* Background processing */
|
|
|
152 |
if ($DrawBackground) {
|
|
|
153 |
$RestoreShadow = $Object->Shadow;
|
|
|
154 |
$Object->Shadow = FALSE;
|
|
|
155 |
if ($BackgroundGradient == NULL) {
|
|
|
156 |
if ($Layout == RADAR_LAYOUT_STAR) {
|
|
|
157 |
|
|
|
158 |
$Color = ["R" => $BackgroundR, "G" => $BackgroundG, "B" => $BackgroundB, "Alpha" => $BackgroundAlpha];
|
|
|
159 |
$PointArray = [];
|
|
|
160 |
for ($i = 0; $i <= 360; $i = $i + (360 / $Points)) {
|
|
|
161 |
$PointArray[] = cos(deg2rad($i + $AxisRotation)) * $EdgeHeight + $CenterX;
|
|
|
162 |
$PointArray[] = sin(deg2rad($i + $AxisRotation)) * $EdgeHeight + $CenterY;
|
|
|
163 |
}
|
|
|
164 |
$Object->drawPolygon($PointArray, $Color);
|
|
|
165 |
|
|
|
166 |
} elseif ($Layout == RADAR_LAYOUT_CIRCLE) {
|
|
|
167 |
$Color =["R" => $BackgroundR,"G" => $BackgroundG,"B" => $BackgroundB,"Alpha" => $BackgroundAlpha];
|
|
|
168 |
$Object->drawFilledCircle($CenterX, $CenterY, $EdgeHeight, $Color);
|
|
|
169 |
}
|
|
|
170 |
} else {
|
|
|
171 |
$GradientROffset = ($BackgroundGradient["EndR"] - $BackgroundGradient["StartR"]) / $Segments;
|
|
|
172 |
$GradientGOffset = ($BackgroundGradient["EndG"] - $BackgroundGradient["StartG"]) / $Segments;
|
|
|
173 |
$GradientBOffset = ($BackgroundGradient["EndB"] - $BackgroundGradient["StartB"]) / $Segments;
|
|
|
174 |
$GradientAlphaOffset = ($BackgroundGradient["EndAlpha"] - $BackgroundGradient["StartAlpha"]) / $Segments;
|
|
|
175 |
if ($Layout == RADAR_LAYOUT_STAR) {
|
|
|
176 |
for ($j = $Segments; $j >= 1; $j--) {
|
|
|
177 |
$Color = [
|
|
|
178 |
"R" => $BackgroundGradient["StartR"] + $GradientROffset * $j,
|
|
|
179 |
"G" => $BackgroundGradient["StartG"] + $GradientGOffset * $j,
|
|
|
180 |
"B" => $BackgroundGradient["StartB"] + $GradientBOffset * $j,
|
|
|
181 |
"Alpha" => $BackgroundGradient["StartAlpha"] + $GradientAlphaOffset * $j
|
|
|
182 |
];
|
|
|
183 |
$PointArray = [];
|
|
|
184 |
for ($i = 0; $i <= 360; $i = $i + (360 / $Points)) {
|
|
|
185 |
$PointArray[] = cos(deg2rad($i + $AxisRotation)) * ($EdgeHeight / $Segments) * $j + $CenterX;
|
|
|
186 |
$PointArray[] = sin(deg2rad($i + $AxisRotation)) * ($EdgeHeight / $Segments) * $j + $CenterY;
|
|
|
187 |
}
|
|
|
188 |
|
|
|
189 |
$Object->drawPolygon($PointArray, $Color);
|
|
|
190 |
}
|
|
|
191 |
} elseif ($Layout == RADAR_LAYOUT_CIRCLE) {
|
|
|
192 |
for ($j = $Segments; $j >= 1; $j--) {
|
|
|
193 |
$Color = [
|
|
|
194 |
"R" => $BackgroundGradient["StartR"] + $GradientROffset * $j,
|
|
|
195 |
"G" => $BackgroundGradient["StartG"] + $GradientGOffset * $j,
|
|
|
196 |
"B" => $BackgroundGradient["StartB"] + $GradientBOffset * $j,
|
|
|
197 |
"Alpha" => $BackgroundGradient["StartAlpha"] + $GradientAlphaOffset * $j
|
|
|
198 |
];
|
|
|
199 |
$Object->drawFilledCircle($CenterX, $CenterY, ($EdgeHeight / $Segments) * $j, $Color);
|
|
|
200 |
}
|
|
|
201 |
}
|
|
|
202 |
}
|
|
|
203 |
|
|
|
204 |
$Object->Shadow = $RestoreShadow;
|
|
|
205 |
}
|
|
|
206 |
|
|
|
207 |
/* Axis to axis lines */
|
|
|
208 |
$Color = ["R" => $AxisR,"G" => $AxisG,"B" => $AxisB,"Alpha" => $AxisAlpha];
|
|
|
209 |
$ColorDotted = ["R" => $AxisR,"G" => $AxisG,"B" => $AxisB,"Alpha" => $AxisAlpha * .8,"Ticks" => 2];
|
|
|
210 |
|
|
|
211 |
if ($Layout == RADAR_LAYOUT_STAR) {
|
|
|
212 |
for ($j = 1; $j <= $Segments; $j++) {
|
|
|
213 |
for ($i = 0; $i < 360; $i = $i + (360 / $Points)) {
|
|
|
214 |
$EdgeX1 = cos(deg2rad($i + $AxisRotation)) * ($EdgeHeight / $Segments) * $j + $CenterX;
|
|
|
215 |
$EdgeY1 = sin(deg2rad($i + $AxisRotation)) * ($EdgeHeight / $Segments) * $j + $CenterY;
|
|
|
216 |
$EdgeX2 = cos(deg2rad($i + $AxisRotation + (360 / $Points))) * ($EdgeHeight / $Segments) * $j + $CenterX;
|
|
|
217 |
$EdgeY2 = sin(deg2rad($i + $AxisRotation + (360 / $Points))) * ($EdgeHeight / $Segments) * $j + $CenterY;
|
|
|
218 |
$Object->drawLine($EdgeX1, $EdgeY1, $EdgeX2, $EdgeY2, $Color);
|
|
|
219 |
}
|
|
|
220 |
}
|
|
|
221 |
} elseif ($Layout == RADAR_LAYOUT_CIRCLE) {
|
|
|
222 |
for ($j = 1; $j <= $Segments; $j++) {
|
|
|
223 |
$Radius = ($EdgeHeight / $Segments) * $j;
|
|
|
224 |
$Object->drawCircle($CenterX, $CenterY, $Radius, $Radius, $Color);
|
|
|
225 |
}
|
|
|
226 |
}
|
|
|
227 |
|
|
|
228 |
if ($DrawAxisValues) {
|
|
|
229 |
if ($LabelsBackground) {
|
|
|
230 |
$Options = ["DrawBox" => TRUE,"Align" => TEXT_ALIGN_MIDDLEMIDDLE,"BoxR" => $LabelsBGR,"BoxG" => $LabelsBGG,"BoxB" => $LabelsBGB,"BoxAlpha" => $LabelsBGAlpha];
|
|
|
231 |
} else {
|
|
|
232 |
$Options = ["Align" => TEXT_ALIGN_MIDDLEMIDDLE];
|
|
|
233 |
}
|
|
|
234 |
|
|
|
235 |
if ($AxisBoxRounded) {
|
|
|
236 |
$Options["BoxRounded"] = TRUE;
|
|
|
237 |
}
|
|
|
238 |
|
|
|
239 |
$Options["FontName"] = $AxisFontName;
|
|
|
240 |
$Options["FontSize"] = $AxisFontSize;
|
|
|
241 |
$Angle = 360 / ($Points * 2);
|
|
|
242 |
|
|
|
243 |
for ($j = 1; $j <= $Segments; $j++) {
|
|
|
244 |
$Label = $j * $SegmentHeight;
|
|
|
245 |
if ($Layout == RADAR_LAYOUT_CIRCLE) {
|
|
|
246 |
$EdgeX1 = cos(deg2rad($Angle + $AxisRotation)) * ($EdgeHeight / $Segments) * $j + $CenterX;
|
|
|
247 |
$EdgeY1 = sin(deg2rad($Angle + $AxisRotation)) * ($EdgeHeight / $Segments) * $j + $CenterY;
|
|
|
248 |
} elseif ($Layout == RADAR_LAYOUT_STAR) {
|
|
|
249 |
$EdgeX1 = cos(deg2rad($AxisRotation)) * ($EdgeHeight / $Segments) * $j + $CenterX;
|
|
|
250 |
$EdgeY1 = sin(deg2rad($AxisRotation)) * ($EdgeHeight / $Segments) * $j + $CenterY;
|
|
|
251 |
$EdgeX2 = cos(deg2rad((360 / $Points) + $AxisRotation)) * ($EdgeHeight / $Segments) * $j + $CenterX;
|
|
|
252 |
$EdgeY2 = sin(deg2rad((360 / $Points) + $AxisRotation)) * ($EdgeHeight / $Segments) * $j + $CenterY;
|
|
|
253 |
$EdgeX1 = ($EdgeX2 - $EdgeX1) / 2 + $EdgeX1;
|
|
|
254 |
$EdgeY1 = ($EdgeY2 - $EdgeY1) / 2 + $EdgeY1;
|
|
|
255 |
}
|
|
|
256 |
|
|
|
257 |
$Object->drawText($EdgeX1, $EdgeY1, $Label, $Options);
|
|
|
258 |
}
|
|
|
259 |
}
|
|
|
260 |
|
|
|
261 |
/* Axis lines */
|
|
|
262 |
$ID = 0;
|
|
|
263 |
for ($i = 0; $i < 360; $i = $i + (360 / $Points)) {
|
|
|
264 |
$EdgeX = cos(deg2rad($i + $AxisRotation)) * ($EdgeHeight + $TicksLength) + $CenterX;
|
|
|
265 |
$EdgeY = sin(deg2rad($i + $AxisRotation)) * ($EdgeHeight + $TicksLength) + $CenterY;
|
|
|
266 |
if ($ID % $SkipLabels == 0) {
|
|
|
267 |
$Object->drawLine($CenterX, $CenterY, $EdgeX, $EdgeY, $Color);
|
|
|
268 |
} else {
|
|
|
269 |
$Object->drawLine($CenterX, $CenterY, $EdgeX, $EdgeY, $ColorDotted);
|
|
|
270 |
}
|
|
|
271 |
|
|
|
272 |
if ($WriteLabels) {
|
|
|
273 |
$LabelX = cos(deg2rad($i + $AxisRotation + $Axisoffset)) * ($EdgeHeight + $LabelPadding + $TicksLength) + $CenterX;
|
|
|
274 |
$LabelY = sin(deg2rad($i + $AxisRotation + $Axisoffset)) * ($EdgeHeight + $LabelPadding + $TicksLength) + $CenterY;
|
|
|
275 |
if ($LabelSerie != "") {
|
|
|
276 |
$Label = isset($Data["Series"][$LabelSerie]["Data"][$ID]) ? $Data["Series"][$LabelSerie]["Data"][$ID] : "";
|
|
|
277 |
} else {
|
|
|
278 |
$Label = $ID;
|
|
|
279 |
}
|
|
|
280 |
|
|
|
281 |
if ($ID % $SkipLabels == 0) {
|
|
|
282 |
if ($LabelPos == RADAR_LABELS_ROTATED) {
|
|
|
283 |
$Align = ["Angle" => (360 - ($i + $AxisRotation + $Axisoffset)) - 90,"Align" => TEXT_ALIGN_BOTTOMMIDDLE];
|
|
|
284 |
} else {
|
|
|
285 |
switch (TRUE) {
|
|
|
286 |
case ((floor($LabelX) == floor($CenterX)) && (floor($LabelY) < floor($CenterY))):
|
|
|
287 |
$Align = ["Align" => TEXT_ALIGN_BOTTOMMIDDLE];
|
|
|
288 |
break;
|
|
|
289 |
case ((floor($LabelX) > floor($CenterX)) && (floor($LabelY) < floor($CenterY))):
|
|
|
290 |
$Align = ["Align" => TEXT_ALIGN_BOTTOMLEFT];
|
|
|
291 |
break;
|
|
|
292 |
case ((floor($LabelX) > floor($CenterX)) && (floor($LabelY) == floor($CenterY))):
|
|
|
293 |
$Align = ["Align" => TEXT_ALIGN_MIDDLELEFT];
|
|
|
294 |
break;
|
|
|
295 |
case ((floor($LabelX) > floor($CenterX)) && (floor($LabelY) > floor($CenterY))):
|
|
|
296 |
$Align = ["Align" => TEXT_ALIGN_TOPLEFT];
|
|
|
297 |
break;
|
|
|
298 |
case ((floor($LabelX) < floor($CenterX)) && (floor($LabelY) < floor($CenterY))):
|
|
|
299 |
$Align = ["Align" => TEXT_ALIGN_BOTTOMRIGHT];
|
|
|
300 |
break;
|
|
|
301 |
case ((floor($LabelX) < floor($CenterX)) && (floor($LabelY) == floor($CenterY))):
|
|
|
302 |
$Align = ["Align" => TEXT_ALIGN_MIDDLERIGHT];
|
|
|
303 |
break;
|
|
|
304 |
case ((floor($LabelX) < floor($CenterX)) && (floor($LabelY) > floor($CenterY))):
|
|
|
305 |
$Align = ["Align" => TEXT_ALIGN_TOPRIGHT];
|
|
|
306 |
break;
|
|
|
307 |
case ((floor($LabelX) == floor($CenterX)) && (floor($LabelY) > floor($CenterY))):
|
|
|
308 |
$Align = ["Align" => TEXT_ALIGN_TOPMIDDLE];
|
|
|
309 |
break;
|
|
|
310 |
}
|
|
|
311 |
}
|
|
|
312 |
|
|
|
313 |
$Object->drawText($LabelX, $LabelY, $Label, $Align);
|
|
|
314 |
}
|
|
|
315 |
}
|
|
|
316 |
|
|
|
317 |
$ID++;
|
|
|
318 |
}
|
|
|
319 |
|
|
|
320 |
/* Compute the plots position */
|
|
|
321 |
$ID = 0;
|
|
|
322 |
$Plot = [];
|
|
|
323 |
foreach($Data["Series"] as $SerieName => $DataS) {
|
|
|
324 |
if ($SerieName != $LabelSerie) {
|
|
|
325 |
|
|
|
326 |
$Color = ["R" => $Palette[$ID]["R"],"G" => $Palette[$ID]["G"],"B" => $Palette[$ID]["B"],"Alpha" => $Palette[$ID]["Alpha"],"Surrounding" => $PointSurrounding];
|
|
|
327 |
|
|
|
328 |
foreach($DataS["Data"] as $Key => $Value) {
|
|
|
329 |
$Angle = (360 / $Points) * $Key;
|
|
|
330 |
$Length = ($EdgeHeight / ($Segments * $SegmentHeight)) * $Value;
|
|
|
331 |
$X = cos(deg2rad($Angle + $AxisRotation)) * $Length + $CenterX;
|
|
|
332 |
$Y = sin(deg2rad($Angle + $AxisRotation)) * $Length + $CenterY;
|
|
|
333 |
$Plot[$ID][] = [$X,$Y,$Value];
|
|
|
334 |
if ($RecordImageMap) {
|
|
|
335 |
$this->pChartObject->addToImageMap("CIRCLE", floor($X) . "," . floor($Y) . "," . floor($PointRadius) , $this->pChartObject->toHTMLColor($Palette[$ID]["R"], $Palette[$ID]["G"], $Palette[$ID]["B"]) , $DataS["Description"], $Data["Series"][$LabelSerie]["Data"][$Key] . " = " . $Value);
|
|
|
336 |
}
|
|
|
337 |
}
|
|
|
338 |
|
|
|
339 |
$ID++;
|
|
|
340 |
}
|
|
|
341 |
}
|
|
|
342 |
|
|
|
343 |
/* Draw all that stuff! */
|
|
|
344 |
foreach($Plot as $ID => $Points) {
|
|
|
345 |
$Color = ["R" => $Palette[$ID]["R"],"G" => $Palette[$ID]["G"],"B" => $Palette[$ID]["B"],"Alpha" => $Palette[$ID]["Alpha"],"Surrounding" => $PointSurrounding];
|
|
|
346 |
/* Draw the polygons */
|
|
|
347 |
if ($DrawPoly) {
|
|
|
348 |
if ($PolyAlpha != NULL) {
|
|
|
349 |
$Color = ["R" => $Palette[$ID]["R"],"G" => $Palette[$ID]["G"],"B" => $Palette[$ID]["B"],"Alpha" => $PolyAlpha,"Surrounding" => $PointSurrounding];
|
|
|
350 |
}
|
|
|
351 |
|
|
|
352 |
$PointsArray = [];
|
|
|
353 |
for ($i = 0; $i < count($Points); $i++) {
|
|
|
354 |
$PointsArray[] = $Points[$i][0];
|
|
|
355 |
$PointsArray[] = $Points[$i][1];
|
|
|
356 |
}
|
|
|
357 |
|
|
|
358 |
$Object->drawPolygon($PointsArray, $Color);
|
|
|
359 |
}
|
|
|
360 |
|
|
|
361 |
$Color = ["R" => $Palette[$ID]["R"],"G" => $Palette[$ID]["G"],"B" => $Palette[$ID]["B"],"Alpha" => $Palette[$ID]["Alpha"],"Surrounding" => $PointSurrounding];
|
|
|
362 |
/* Bubble and labels settings */
|
|
|
363 |
$TextSettings = array("Align" => TEXT_ALIGN_MIDDLEMIDDLE,"FontName" => $ValueFontName,"FontSize" => $ValueFontSize,"R" => $Palette[$ID]["R"],"G" => $Palette[$ID]["G"],"B" => $Palette[$ID]["B"]);
|
|
|
364 |
$InnerColor = ["R" => $InnerBubbleR,"G" => $InnerBubbleG,"B" => $InnerBubbleB,"Alpha" => $InnerBubbleAlpha];
|
|
|
365 |
|
|
|
366 |
if ($OuterBubbleR != VOID) {
|
|
|
367 |
$OuterColor = ["R" => $OuterBubbleR,"G" => $OuterBubbleG,"B" => $OuterBubbleB,"Alpha" => $OuterBubbleAlpha];
|
|
|
368 |
} else {
|
|
|
369 |
$OuterColor = ["R" => $Palette[$ID]["R"] + 20,"G" => $Palette[$ID]["G"] + 20,"B" => $Palette[$ID]["B"] + 20,"Alpha" => $Palette[$ID]["Alpha"]];
|
|
|
370 |
}
|
|
|
371 |
|
|
|
372 |
/* Loop to the starting points if asked */
|
|
|
373 |
if ($LineLoopStart && $DrawLines) $Object->drawLine($Points[count($Points) - 1][0], $Points[count($Points) - 1][1], $Points[0][0], $Points[0][1], $Color);
|
|
|
374 |
/* Draw the lines & points */
|
|
|
375 |
for ($i = 0; $i < count($Points); $i++) {
|
|
|
376 |
if ($DrawLines && $i < count($Points) - 1) {
|
|
|
377 |
$Object->drawLine($Points[$i][0], $Points[$i][1], $Points[$i + 1][0], $Points[$i + 1][1], $Color);
|
|
|
378 |
}
|
|
|
379 |
|
|
|
380 |
if ($DrawPoints) {
|
|
|
381 |
$Object->drawFilledCircle($Points[$i][0], $Points[$i][1], $PointRadius, $Color);
|
|
|
382 |
}
|
|
|
383 |
|
|
|
384 |
if ($WriteValuesInBubble && $WriteValues) {
|
|
|
385 |
$TxtPos = $this->pChartObject->getTextBox($Points[$i][0], $Points[$i][1], $ValueFontName, $ValueFontSize, 0, $Points[$i][2]);
|
|
|
386 |
$Radius = floor(($TxtPos[1]["X"] - $TxtPos[0]["X"] + $ValuePadding * 2) / 2);
|
|
|
387 |
$this->pChartObject->drawFilledCircle($Points[$i][0], $Points[$i][1], $Radius + $OuterBubbleRadius, $OuterColor);
|
|
|
388 |
$this->pChartObject->drawFilledCircle($Points[$i][0], $Points[$i][1], $Radius, $InnerColor);
|
|
|
389 |
}
|
|
|
390 |
|
|
|
391 |
if ($WriteValues) {
|
|
|
392 |
$this->pChartObject->drawText($Points[$i][0] - 1, $Points[$i][1] - 1, $Points[$i][2], $TextSettings);
|
|
|
393 |
}
|
|
|
394 |
}
|
|
|
395 |
}
|
|
|
396 |
}
|
|
|
397 |
|
|
|
398 |
/* Draw a radar chart */
|
|
|
399 |
function drawPolar($Object, $Values, array $Format = [])
|
|
|
400 |
{
|
|
|
401 |
$this->pChartObject = $Object;
|
|
|
402 |
$FixedMax = VOID;
|
|
|
403 |
$AxisR = 60;
|
|
|
404 |
$AxisG = 60;
|
|
|
405 |
$AxisB = 60;
|
|
|
406 |
$AxisAlpha = 50;
|
|
|
407 |
$AxisRotation = -90;
|
|
|
408 |
$DrawTicks = TRUE;
|
|
|
409 |
$TicksLength = 2;
|
|
|
410 |
$DrawAxisValues = TRUE;
|
|
|
411 |
$AxisBoxRounded = TRUE;
|
|
|
412 |
$AxisFontName = isset($Format["FontName"]) ? $Format["FontName"] : $this->pChartObject->FontName;
|
|
|
413 |
$AxisFontSize = isset($Format["FontSize"]) ? $Format["FontSize"] : $this->pChartObject->FontSize;
|
|
|
414 |
$WriteValues = FALSE;
|
|
|
415 |
$WriteValuesInBubble = TRUE;
|
|
|
416 |
$ValueFontName = $this->pChartObject->FontName;
|
|
|
417 |
$ValueFontSize = $this->pChartObject->FontSize;
|
|
|
418 |
$ValuePadding = 4;
|
|
|
419 |
$OuterBubbleRadius = 2;
|
|
|
420 |
$OuterBubbleR = VOID;
|
|
|
421 |
$OuterBubbleG = VOID;
|
|
|
422 |
$OuterBubbleB = VOID;
|
|
|
423 |
$OuterBubbleAlpha = 100;
|
|
|
424 |
$InnerBubbleR = 255;
|
|
|
425 |
$InnerBubbleG = 255;
|
|
|
426 |
$InnerBubbleB = 255;
|
|
|
427 |
$InnerBubbleAlpha = 100;
|
|
|
428 |
$DrawBackground = TRUE;
|
|
|
429 |
$BackgroundR = 255;
|
|
|
430 |
$BackgroundG = 255;
|
|
|
431 |
$BackgroundB = 255;
|
|
|
432 |
$BackgroundAlpha = 50;
|
|
|
433 |
$BackgroundGradient = NULL;
|
|
|
434 |
$AxisSteps = 20;
|
|
|
435 |
$SegmentHeight = SEGMENT_HEIGHT_AUTO;
|
|
|
436 |
$Segments = 4;
|
|
|
437 |
$WriteLabels = TRUE;
|
|
|
438 |
$LabelsBackground = TRUE;
|
|
|
439 |
$LabelsBGR = 255;
|
|
|
440 |
$LabelsBGG = 255;
|
|
|
441 |
$LabelsBGB = 255;
|
|
|
442 |
$LabelsBGAlpha = 50;
|
|
|
443 |
$LabelPos = RADAR_LABELS_ROTATED;
|
|
|
444 |
$LabelPadding = 4;
|
|
|
445 |
$DrawPoints = TRUE;
|
|
|
446 |
$PointRadius = 4;
|
|
|
447 |
$PointSurrounding = isset($Format["PointRadius"]) ? $Format["PointRadius"] : -30;
|
|
|
448 |
$DrawLines = TRUE;
|
|
|
449 |
$LineLoopStart = FALSE;
|
|
|
450 |
$DrawPoly = FALSE;
|
|
|
451 |
$PolyAlpha = NULL;
|
|
|
452 |
$FontSize = $Object->FontSize;
|
|
|
453 |
$X1 = $Object->GraphAreaX1;
|
|
|
454 |
$Y1 = $Object->GraphAreaY1;
|
|
|
455 |
$X2 = $Object->GraphAreaX2;
|
|
|
456 |
$Y2 = $Object->GraphAreaY2;
|
|
|
457 |
$RecordImageMap = FALSE;
|
|
|
458 |
|
|
|
459 |
/* Override defaults */
|
|
|
460 |
extract($Format);
|
|
|
461 |
|
|
|
462 |
($AxisBoxRounded) AND $DrawAxisValues = TRUE;
|
|
|
463 |
|
|
|
464 |
/* Cancel default tick length if ticks not enabled */
|
|
|
465 |
($DrawTicks == FALSE) AND $TicksLength = 0;
|
|
|
466 |
|
|
|
467 |
/* Data Processing */
|
|
|
468 |
$Data = $Values->getData();
|
|
|
469 |
$Palette = $Values->getPalette();
|
|
|
470 |
/* Catch the number of required axis */
|
|
|
471 |
$LabelSerie = $Data["Abscissa"];
|
|
|
472 |
if ($LabelSerie != "") {
|
|
|
473 |
$Points = count($Data["Series"][$LabelSerie]["Data"]);
|
|
|
474 |
} else {
|
|
|
475 |
$Points = 0;
|
|
|
476 |
foreach($Data["Series"] as $SerieName => $DataArray) {
|
|
|
477 |
(count($DataArray["Data"]) > $Points) AND $Points = count($DataArray["Data"]);
|
|
|
478 |
}
|
|
|
479 |
}
|
|
|
480 |
|
|
|
481 |
/* Draw the axis */
|
|
|
482 |
$CenterX = ($X2 - $X1) / 2 + $X1;
|
|
|
483 |
$CenterY = ($Y2 - $Y1) / 2 + $Y1;
|
|
|
484 |
$EdgeHeight = min(($X2 - $X1) / 2, ($Y2 - $Y1) / 2);
|
|
|
485 |
if ($WriteLabels) {
|
|
|
486 |
$EdgeHeight = $EdgeHeight - $FontSize - $LabelPadding - $TicksLength;
|
|
|
487 |
}
|
|
|
488 |
|
|
|
489 |
/* Determine the scale if set to automatic */
|
|
|
490 |
if ($SegmentHeight == SEGMENT_HEIGHT_AUTO) {
|
|
|
491 |
if ($FixedMax != VOID) {
|
|
|
492 |
$Max = $FixedMax;
|
|
|
493 |
} else {
|
|
|
494 |
$Max = 0;
|
|
|
495 |
foreach($Data["Series"] as $SerieName => $DataArray) {
|
|
|
496 |
if ($SerieName != $LabelSerie) {
|
|
|
497 |
if (max($DataArray["Data"]) > $Max) {
|
|
|
498 |
$Max = max($DataArray["Data"]);
|
|
|
499 |
}
|
|
|
500 |
}
|
|
|
501 |
}
|
|
|
502 |
}
|
|
|
503 |
|
|
|
504 |
$MaxSegments = $EdgeHeight / 20;
|
|
|
505 |
$Scale = $Object->computeScale(0, $Max, $MaxSegments, [1,2,5]);
|
|
|
506 |
$Segments = $Scale["Rows"];
|
|
|
507 |
$SegmentHeight = $Scale["RowHeight"];
|
|
|
508 |
}
|
|
|
509 |
|
|
|
510 |
/* Background processing */
|
|
|
511 |
if ($DrawBackground) {
|
|
|
512 |
$RestoreShadow = $Object->Shadow;
|
|
|
513 |
$Object->Shadow = FALSE;
|
|
|
514 |
if ($BackgroundGradient == NULL) {
|
|
|
515 |
$Color = ["R" => $BackgroundR,"G" => $BackgroundG,"B" => $BackgroundB,"Alpha" => $BackgroundAlpha];
|
|
|
516 |
$Object->drawFilledCircle($CenterX, $CenterY, $EdgeHeight, $Color);
|
|
|
517 |
} else {
|
|
|
518 |
$GradientROffset = ($BackgroundGradient["EndR"] - $BackgroundGradient["StartR"]) / $Segments;
|
|
|
519 |
$GradientGOffset = ($BackgroundGradient["EndG"] - $BackgroundGradient["StartG"]) / $Segments;
|
|
|
520 |
$GradientBOffset = ($BackgroundGradient["EndB"] - $BackgroundGradient["StartB"]) / $Segments;
|
|
|
521 |
$GradientAlphaOffset = ($BackgroundGradient["EndAlpha"] - $BackgroundGradient["StartAlpha"]) / $Segments;
|
|
|
522 |
for ($j = $Segments; $j >= 1; $j--) {
|
|
|
523 |
$Color = [
|
|
|
524 |
"R" => $BackgroundGradient["StartR"] + $GradientROffset * $j,
|
|
|
525 |
"G" => $BackgroundGradient["StartG"] + $GradientGOffset * $j,
|
|
|
526 |
"B" => $BackgroundGradient["StartB"] + $GradientBOffset * $j,
|
|
|
527 |
"Alpha" => $BackgroundGradient["StartAlpha"] + $GradientAlphaOffset * $j
|
|
|
528 |
];
|
|
|
529 |
$Object->drawFilledCircle($CenterX, $CenterY, ($EdgeHeight / $Segments) * $j, $Color);
|
|
|
530 |
}
|
|
|
531 |
}
|
|
|
532 |
|
|
|
533 |
$Object->Shadow = $RestoreShadow;
|
|
|
534 |
}
|
|
|
535 |
|
|
|
536 |
/* Axis to axis lines */
|
|
|
537 |
$Color = ["R" => $AxisR,"G" => $AxisG,"B" => $AxisB,"Alpha" => $AxisAlpha];
|
|
|
538 |
for ($j = 1; $j <= $Segments; $j++) {
|
|
|
539 |
$Radius = ($EdgeHeight / $Segments) * $j;
|
|
|
540 |
$Object->drawCircle($CenterX, $CenterY, $Radius, $Radius, $Color);
|
|
|
541 |
}
|
|
|
542 |
|
|
|
543 |
if ($DrawAxisValues) {
|
|
|
544 |
if ($LabelsBackground) {
|
|
|
545 |
$Options = ["DrawBox" => TRUE,"Align" => TEXT_ALIGN_MIDDLEMIDDLE,"BoxR" => $LabelsBGR,"BoxG" => $LabelsBGG,"BoxB" => $LabelsBGB,"BoxAlpha" => $LabelsBGAlpha];
|
|
|
546 |
} else {
|
|
|
547 |
$Options = ["Align" => TEXT_ALIGN_MIDDLEMIDDLE];
|
|
|
548 |
}
|
|
|
549 |
|
|
|
550 |
($AxisBoxRounded) AND $Options["BoxRounded"] = TRUE;
|
|
|
551 |
|
|
|
552 |
$Options["FontName"] = $AxisFontName;
|
|
|
553 |
$Options["FontSize"] = $AxisFontSize;
|
|
|
554 |
$Angle = 360 / ($Points * 2);
|
|
|
555 |
for ($j = 1; $j <= $Segments; $j++) {
|
|
|
556 |
$EdgeX1 = cos(deg2rad($Angle + $AxisRotation)) * ($EdgeHeight / $Segments) * $j + $CenterX;
|
|
|
557 |
$EdgeY1 = sin(deg2rad($Angle + $AxisRotation)) * ($EdgeHeight / $Segments) * $j + $CenterY;
|
|
|
558 |
$Label = $j * $SegmentHeight;
|
|
|
559 |
$Object->drawText($EdgeX1, $EdgeY1, $Label, $Options);
|
|
|
560 |
}
|
|
|
561 |
}
|
|
|
562 |
|
|
|
563 |
/* Axis lines */
|
|
|
564 |
$ID = 0;
|
|
|
565 |
for ($i = 0; $i <= 359; $i = $i + $AxisSteps) {
|
|
|
566 |
$EdgeX = cos(deg2rad($i + $AxisRotation)) * ($EdgeHeight + $TicksLength) + $CenterX;
|
|
|
567 |
$EdgeY = sin(deg2rad($i + $AxisRotation)) * ($EdgeHeight + $TicksLength) + $CenterY;
|
|
|
568 |
$Object->drawLine($CenterX, $CenterY, $EdgeX, $EdgeY, $Color);
|
|
|
569 |
if ($WriteLabels) {
|
|
|
570 |
$LabelX = cos(deg2rad($i + $AxisRotation)) * ($EdgeHeight + $LabelPadding + $TicksLength) + $CenterX;
|
|
|
571 |
$LabelY = sin(deg2rad($i + $AxisRotation)) * ($EdgeHeight + $LabelPadding + $TicksLength) + $CenterY;
|
|
|
572 |
$Label = $i . "°";
|
|
|
573 |
|
|
|
574 |
if ($LabelPos == RADAR_LABELS_ROTATED) {
|
|
|
575 |
$Align = ["Angle" => (360 - $i),"Align" => TEXT_ALIGN_BOTTOMMIDDLE];
|
|
|
576 |
} else {
|
|
|
577 |
switch (TRUE) {
|
|
|
578 |
case ((floor($LabelX) == floor($CenterX)) && (floor($LabelY) < floor($CenterY))):
|
|
|
579 |
$Align = ["Align" => TEXT_ALIGN_BOTTOMMIDDLE];
|
|
|
580 |
break;
|
|
|
581 |
case ((floor($LabelX) > floor($CenterX)) && (floor($LabelY) < floor($CenterY))):
|
|
|
582 |
$Align = ["Align" => TEXT_ALIGN_BOTTOMLEFT];
|
|
|
583 |
break;
|
|
|
584 |
case ((floor($LabelX) > floor($CenterX)) && (floor($LabelY) == floor($CenterY))):
|
|
|
585 |
$Align = ["Align" => TEXT_ALIGN_MIDDLELEFT];
|
|
|
586 |
break;
|
|
|
587 |
case ((floor($LabelX) > floor($CenterX)) && (floor($LabelY) > floor($CenterY))):
|
|
|
588 |
$Align = ["Align" => TEXT_ALIGN_TOPLEFT];
|
|
|
589 |
break;
|
|
|
590 |
case ((floor($LabelX) < floor($CenterX)) && (floor($LabelY) < floor($CenterY))):
|
|
|
591 |
$Align = ["Align" => TEXT_ALIGN_BOTTOMRIGHT];
|
|
|
592 |
break;
|
|
|
593 |
case ((floor($LabelX) < floor($CenterX)) && (floor($LabelY) == floor($CenterY))):
|
|
|
594 |
$Align = ["Align" => TEXT_ALIGN_MIDDLERIGHT];
|
|
|
595 |
break;
|
|
|
596 |
case ((floor($LabelX) < floor($CenterX)) && (floor($LabelY) > floor($CenterY))):
|
|
|
597 |
$Align = ["Align" => TEXT_ALIGN_TOPRIGHT];
|
|
|
598 |
break;
|
|
|
599 |
case ((floor($LabelX) == floor($CenterX)) && (floor($LabelY) > floor($CenterY))):
|
|
|
600 |
$Align = ["Align" => TEXT_ALIGN_TOPMIDDLE];
|
|
|
601 |
break;
|
|
|
602 |
}
|
|
|
603 |
}
|
|
|
604 |
|
|
|
605 |
$Object->drawText($LabelX, $LabelY, $Label, $Align);
|
|
|
606 |
}
|
|
|
607 |
|
|
|
608 |
$ID++;
|
|
|
609 |
}
|
|
|
610 |
|
|
|
611 |
/* Compute the plots position */
|
|
|
612 |
$ID = 0;
|
|
|
613 |
$Plot = [];
|
|
|
614 |
foreach($Data["Series"] as $SerieName => $DataSet) {
|
|
|
615 |
if ($SerieName != $LabelSerie) {
|
|
|
616 |
|
|
|
617 |
$Color = array("R" => $Palette[$ID]["R"],"G" => $Palette[$ID]["G"],"B" => $Palette[$ID]["B"],"Alpha" => $Palette[$ID]["Alpha"],"Surrounding" => $PointSurrounding);
|
|
|
618 |
|
|
|
619 |
foreach($DataSet["Data"] as $Key => $Value) {
|
|
|
620 |
$Angle = $Data["Series"][$LabelSerie]["Data"][$Key];
|
|
|
621 |
$Length = ($EdgeHeight / ($Segments * $SegmentHeight)) * $Value;
|
|
|
622 |
$X = cos(deg2rad($Angle + $AxisRotation)) * $Length + $CenterX;
|
|
|
623 |
$Y = sin(deg2rad($Angle + $AxisRotation)) * $Length + $CenterY;
|
|
|
624 |
if ($RecordImageMap) {
|
|
|
625 |
$this->pChartObject->addToImageMap("CIRCLE", floor($X) . "," . floor($Y) . "," . floor($PointRadius) , $this->pChartObject->toHTMLColor($Palette[$ID]["R"], $Palette[$ID]["G"], $Palette[$ID]["B"]) , $DataSet["Description"], $Data["Series"][$LabelSerie]["Data"][$Key] . "° = " . $Value);
|
|
|
626 |
}
|
|
|
627 |
|
|
|
628 |
$Plot[$ID][] = [$X,$Y,$Value];
|
|
|
629 |
}
|
|
|
630 |
|
|
|
631 |
$ID++;
|
|
|
632 |
}
|
|
|
633 |
}
|
|
|
634 |
|
|
|
635 |
/* Draw all that stuff! */
|
|
|
636 |
foreach($Plot as $ID => $Points) {
|
|
|
637 |
$Color = array("R" => $Palette[$ID]["R"],"G" => $Palette[$ID]["G"],"B" => $Palette[$ID]["B"],"Alpha" => $Palette[$ID]["Alpha"],"Surrounding" => $PointSurrounding);
|
|
|
638 |
/* Draw the polygons */
|
|
|
639 |
if ($DrawPoly) {
|
|
|
640 |
if ($PolyAlpha != NULL) {
|
|
|
641 |
$Color = array("R" => $Palette[$ID]["R"],"G" => $Palette[$ID]["G"],"B" => $Palette[$ID]["B"],"Alpha" => $PolyAlpha,"Surrounding" => $PointSurrounding);
|
|
|
642 |
}
|
|
|
643 |
|
|
|
644 |
$PointsArray = [];
|
|
|
645 |
for ($i = 0; $i < count($Points); $i++) {
|
|
|
646 |
$PointsArray[] = $Points[$i][0];
|
|
|
647 |
$PointsArray[] = $Points[$i][1];
|
|
|
648 |
}
|
|
|
649 |
|
|
|
650 |
$Object->drawPolygon($PointsArray, $Color);
|
|
|
651 |
}
|
|
|
652 |
|
|
|
653 |
$Color = array("R" => $Palette[$ID]["R"],"G" => $Palette[$ID]["G"],"B" => $Palette[$ID]["B"],"Alpha" => $Palette[$ID]["Alpha"],"Surrounding" => $PointSurrounding);
|
|
|
654 |
/* Bubble and labels settings */
|
|
|
655 |
$TextSettings = array("Align" => TEXT_ALIGN_MIDDLEMIDDLE,"FontName" => $ValueFontName,"FontSize" => $ValueFontSize,"R" => $Palette[$ID]["R"],"G" => $Palette[$ID]["G"],"B" => $Palette[$ID]["B"]);
|
|
|
656 |
$InnerColor = array("R" => $InnerBubbleR,"G" => $InnerBubbleG,"B" => $InnerBubbleB,"Alpha" => $InnerBubbleAlpha);
|
|
|
657 |
if ($OuterBubbleR != VOID) {
|
|
|
658 |
$OuterColor = array("R" => $OuterBubbleR,"G" => $OuterBubbleG,"B" => $OuterBubbleB,"Alpha" => $OuterBubbleAlpha);
|
|
|
659 |
} else {
|
|
|
660 |
$OuterColor = array("R" => $Palette[$ID]["R"] + 20,"G" => $Palette[$ID]["G"] + 20,"B" => $Palette[$ID]["B"] + 20,"Alpha" => $Palette[$ID]["Alpha"]);
|
|
|
661 |
}
|
|
|
662 |
|
|
|
663 |
/* Loop to the starting points if asked */
|
|
|
664 |
if ($LineLoopStart && $DrawLines) {
|
|
|
665 |
$Object->drawLine($Points[count($Points) - 1][0], $Points[count($Points) - 1][1], $Points[0][0], $Points[0][1], $Color);
|
|
|
666 |
}
|
|
|
667 |
|
|
|
668 |
/* Draw the lines & points */
|
|
|
669 |
for ($i = 0; $i < count($Points); $i++) {
|
|
|
670 |
if ($DrawLines && $i < count($Points) - 1) {
|
|
|
671 |
$Object->drawLine($Points[$i][0], $Points[$i][1], $Points[$i + 1][0], $Points[$i + 1][1], $Color);
|
|
|
672 |
}
|
|
|
673 |
|
|
|
674 |
if ($DrawPoints) {
|
|
|
675 |
$Object->drawFilledCircle($Points[$i][0], $Points[$i][1], $PointRadius, $Color);
|
|
|
676 |
}
|
|
|
677 |
|
|
|
678 |
if ($WriteValuesInBubble && $WriteValues) {
|
|
|
679 |
$TxtPos = $this->pChartObject->getTextBox($Points[$i][0], $Points[$i][1], $ValueFontName, $ValueFontSize, 0, $Points[$i][2]);
|
|
|
680 |
$Radius = floor(($TxtPos[1]["X"] - $TxtPos[0]["X"] + $ValuePadding * 2) / 2);
|
|
|
681 |
$this->pChartObject->drawFilledCircle($Points[$i][0], $Points[$i][1], $Radius + $OuterBubbleRadius, $OuterColor);
|
|
|
682 |
$this->pChartObject->drawFilledCircle($Points[$i][0], $Points[$i][1], $Radius, $InnerColor);
|
|
|
683 |
}
|
|
|
684 |
|
|
|
685 |
if ($WriteValues) {
|
|
|
686 |
$this->pChartObject->drawText($Points[$i][0] - 1, $Points[$i][1] - 1, $Points[$i][2], $TextSettings);
|
|
|
687 |
}
|
|
|
688 |
}
|
|
|
689 |
}
|
|
|
690 |
}
|
|
|
691 |
}
|
|
|
692 |
|
|
|
693 |
?>
|