Lines Matching refs:this

20  *    along with this program.  If not, see <http://www.gnu.org/licenses/>.
118 $this->palette = Palette::defaultPalette();
120 $this->XSize = $XSize;
121 $this->YSize = $YSize;
123 $this->setFontProperties("tahoma.ttf", 8);
125 $this->shadowProperties = ShadowProperties::FromDefaults();
127 $this->canvas = $canvas;
134 $this->ErrorReporting = TRUE;
135 $this->ErrorInterface = $Interface;
147 $this->FontName = $FontFile;
148 $this->FontSize = $FontSize;
157 $this->palette = $newPalette;
168 $this->shadowProperties = ShadowProperties::FromSettings(
181 $this->shadowProperties = ShadowProperties::FromDefaults();
188 $this->palette = Palette::fromFile($FileName, $Delimiter);
195 $this->LineWidth = $Width;
196 $this->LineDotSize = $DotSize;
203 $this->GArea_X1 = $X1;
204 $this->GArea_Y1 = $Y1;
205 $this->GArea_X2 = $X2;
206 $this->GArea_Y2 = $Y2;
213 $this->canvas->drawFilledRectangle(
214 new Point($this->GArea_X1, $this->GArea_Y1),
215 new Point($this->GArea_X2, $this->GArea_Y2),
217 $this->shadowProperties, FALSE
219 $this->canvas->drawRectangle(
220 new Point($this->GArea_X1, $this->GArea_Y1),
221 new Point($this->GArea_X2, $this->GArea_Y2),
225 $this->shadowProperties
231 $SkewWidth = $this->GArea_Y2 - $this->GArea_Y1 - 1;
233 for($i = $this->GArea_X1 - $SkewWidth; $i <= $this->GArea_X2; $i = $i + 4) {
235 $Y1 = $this->GArea_Y2;
237 $Y2 = $this->GArea_Y1;
239 if($X1 < $this->GArea_X1) {
240 $X1 = $this->GArea_X1;
241 $Y1 = $this->GArea_Y1 + $X2 - $this->GArea_X1 + 1;
244 if($X2 >= $this->GArea_X2) {
245 $Y2 = $this->GArea_Y1 + $X2 - $this->GArea_X2 + 1;
246 $X2 = $this->GArea_X2 - 1;
249 $this->canvas->drawLine(
262 $this->drawGraphArea($style);
263 $this->drawGraphAreaGradient($style);
270 $this->VMin = NULL;
271 $this->VMax = NULL;
272 $this->VXMin = NULL;
273 $this->VXMax = NULL;
274 $this->Divisions = NULL;
275 $this->XDivisions = NULL;
279 * Allow you to fix the scale, use this to bypass the automatic scaling
282 $this->VMin = $VMin;
283 $this->VMax = $VMax;
284 $this->Divisions = $Divisions;
287 $this->VXMin = $VXMin;
288 $this->VXMax = $VXMax;
289 $this->XDivisions = $XDivisions;
298 $this->drawScale($data, $style, $Angle, $Decimals, $WithMargin, $SkipLabels, TRUE);
306 $this->validateData("drawScale", $Data->getData());
308 $this->canvas->drawLine(
309 new Point($this->GArea_X1, $this->GArea_Y1),
310 new Point($this->GArea_X1, $this->GArea_Y2),
314 $this->shadowProperties
316 $this->canvas->drawLine(
317 new Point($this->GArea_X1, $this->GArea_Y2),
318 new Point($this->GArea_X2, $this->GArea_Y2),
322 $this->shadowProperties
325 if($this->VMin == NULL && $this->VMax == NULL) {
326 $Divisions = $this->calculateDivisions($Data, $style);
328 $Divisions = $this->Divisions;
330 $this->DivisionCount = $Divisions;
332 $DataRange = $this->VMax - $this->VMin;
337 $this->DivisionHeight = ($this->GArea_Y2 - $this->GArea_Y1) / $Divisions;
338 $this->DivisionRatio = ($this->GArea_Y2 - $this->GArea_Y1) / $DataRange;
340 $this->GAreaXOffset = 0;
343 $this->DivisionWidth = ($this->GArea_X2 - $this->GArea_X1) / (count($Data->getData()) - 1);
345 $this->DivisionWidth = ($this->GArea_X2 - $this->GArea_X1) / (count($Data->getData()));
346 $this->GAreaXOffset = $this->DivisionWidth / 2;
349 $this->DivisionWidth = $this->GArea_X2 - $this->GArea_X1;
350 $this->GAreaXOffset = $this->DivisionWidth / 2;
353 $this->DataCount = count($Data->getData());
358 $YPos = $this->GArea_Y2;
362 $this->canvas->drawLine(
363 new Point($this->GArea_X2, $YPos),
364 new Point($this->GArea_X2 + 5, $YPos),
368 $this->shadowProperties
371 $this->canvas->drawLine(
372 new Point($this->GArea_X1, $YPos),
373 new Point($this->GArea_X1 - 5, $YPos),
377 $this->shadowProperties
380 $Value = $this->VMin + ($i - 1) * (($this->VMax - $this->VMin) / $Divisions);
382 $Value = $this->convertValueForDisplay(
388 $Position = imageftbbox($this->FontSize, 0, $this->FontName, $Value);
392 $this->canvas->drawText(
393 $this->FontSize, 0,
394 new Point($this->GArea_X2 + 10,
395 $YPos + ($this->FontSize / 2)),
397 $this->FontName,
401 if($XMin < $this->GArea_X2 + 15 + $TextWidth || $XMin == NULL) {
402 $XMin = $this->GArea_X2 + 15 + $TextWidth;
405 $this->canvas->drawText(
406 $this->FontSize,
408 new Point($this->GArea_X1 - 10 - $TextWidth,
409 $YPos + ($this->FontSize / 2)),
411 $this->FontName,
415 if($XMin > $this->GArea_X1 - 10 - $TextWidth || $XMin == NULL) {
416 $XMin = $this->GArea_X1 - 10 - $TextWidth;
420 $YPos = $YPos - $this->DivisionHeight;
425 $Position = imageftbbox($this->FontSize, 90, $this->FontName, $Data->getDataDescription()->getYAxisName());
427 $TextTop = (($this->GArea_Y2 - $this->GArea_Y1) / 2) + $this->GArea_Y1 + ($TextHeight / 2);
430 $this->canvas->drawText(
431 $this->FontSize, 90,
432 new Point($XMin + $this->FontSize,
434 $style->getColor(), $this->FontName,
439 $this->canvas->drawText(
440 $this->FontSize, 90,
441 new Point($XMin - $this->FontSize,
443 $style->getColor(), $this->FontName,
451 $XPos = $this->GArea_X1 + $this->GAreaXOffset;
456 $this->canvas->drawLine(
457 new Point(floor($XPos), $this->GArea_Y2),
458 new Point(floor($XPos), $this->GArea_Y2 + 5),
462 $this->shadowProperties
465 $Value = $this->convertValueForDisplay(
471 $Position = imageftbbox($this->FontSize, $Angle, $this->FontName, $Value);
476 $YPos = $this->GArea_Y2 + 18;
477 $this->canvas->drawText(
478 $this->FontSize,
483 $this->FontName,
488 $YPos = $this->GArea_Y2 + 10 + $TextHeight;
490 $this->canvas->drawText(
491 $this->FontSize,
496 $this->FontName,
501 $this->canvas->drawText(
502 $this->FontSize,
507 $this->FontName,
518 $XPos = $XPos + $this->DivisionWidth;
525 $this->FontSize, 90,
526 $this->FontName,
530 $TextLeft = (($this->GArea_X2 - $this->GArea_X1) / 2) + $this->GArea_X1 + ($TextWidth / 2);
531 $this->canvas->drawText(
532 $this->FontSize, 0,
534 $YMax + $this->FontSize + 5),
535 $style->getColor(), $this->FontName,
547 * divisions are clearly visible, so this is also a function of
560 $this->VMin = $dataArray[0] [$Data->getDataDescription()->values[0]];
561 $this->VMax = $dataArray[0] [$Data->getDataDescription()->values[0]];
563 $this->VMin = 2147483647;
564 $this->VMax = -2147483647;
572 $this->VMin = 0;
581 if($this->VMax < $Value) {
582 $this->VMax = $Value;
584 if($this->VMin > $Value) {
585 $this->VMin = $Value;
593 $this->VMin = 0;
606 if($this->VMax < $Sum) {
607 $this->VMax = $Sum;
609 if($this->VMin > $Sum) {
610 $this->VMin = $Sum;
615 $this->VMax = ceil($this->VMax);
618 if($this->VMax == $this->VMin) {
619 if($this->VMax >= 0) {
620 $this->VMax++;
622 $this->VMin--;
626 $DataRange = $this->VMax - $this->VMin;
631 $this->calculateScales($Scale, $Divisions);
647 $this->validateData("drawScale", $Data->getData());
649 $this->canvas->drawLine(
650 new Point($this->GArea_X1, $this->GArea_Y1),
651 new Point($this->GArea_X1, $this->GArea_Y2),
655 $this->shadowProperties
657 $this->canvas->drawLine(
658 new Point($this->GArea_X1, $this->GArea_Y2),
659 new Point($this->GArea_X2, $this->GArea_Y2),
663 $this->shadowProperties
667 if($this->VMin == NULL && $this->VMax == NULL) {
668 $this->VMin = $Data->getSeriesMin($YSerieName);
669 $this->VMax = $Data->getSeriesMax($YSerieName);
673 $this->VMax = ceil($this->VMax);
675 $DataRange = $this->VMax - $this->VMin;
681 $this->GArea_Y1,
682 $this->GArea_Y2,
683 $this->VMin,
684 $this->VMax,
688 $Divisions = $this->Divisions;
690 $this->DivisionCount = $Divisions;
692 $DataRange = $this->VMax - $this->VMin;
697 $this->DivisionHeight = ($this->GArea_Y2 - $this->GArea_Y1) / $Divisions;
698 $this->DivisionRatio = ($this->GArea_Y2 - $this->GArea_Y1) / $DataRange;
700 $YPos = $this->GArea_Y2;
703 $this->canvas->drawLine(
704 new Point($this->GArea_X1, $YPos),
705 new Point($this->GArea_X1 - 5, $YPos),
709 $this->shadowProperties
711 $Value = $this->VMin + ($i - 1) * (($this->VMax - $this->VMin) / $Divisions);
713 $Value = $this->convertValueForDisplay(
719 $Position = imageftbbox($this->FontSize, 0, $this->FontName, $Value);
721 $this->canvas->drawText(
722 $this->FontSize,
724 new Point($this->GArea_X1 - 10 - $TextWidth,
725 $YPos + ($this->FontSize / 2)),
727 $this->FontName,
729 $this->shadowProperties
732 if($XMin > $this->GArea_X1 - 10 - $TextWidth || $XMin == NULL) {
733 $XMin = $this->GArea_X1 - 10 - $TextWidth;
736 $YPos = $YPos - $this->DivisionHeight;
740 if($this->VXMin == NULL && $this->VXMax == NULL) {
741 $this->VXMax = $Data->getSeriesMax($XSerieName);
742 $this->VXMin = $Data->getSeriesMin($XSerieName);
744 $this->VXMax = ceil($this->VXMax);
746 $DataRange = $this->VMax - $this->VMin;
753 $this->GArea_X1, $this->GArea_X2,
754 $this->VXMin, $this->VXMax,
758 $XDivisions = $this->XDivisions;
760 $this->XDivisionCount = $Divisions;
761 $this->DataCount = $Divisions + 2;
763 $XDataRange = $this->VXMax - $this->VXMin;
768 $this->DivisionWidth = ($this->GArea_X2 - $this->GArea_X1) / $XDivisions;
769 $this->XDivisionRatio = ($this->GArea_X2 - $this->GArea_X1) / $XDataRange;
771 $XPos = $this->GArea_X1;
774 $this->canvas->drawLine(
775 new Point($XPos, $this->GArea_Y2),
776 new Point($XPos, $this->GArea_Y2 + 5),
780 $this->shadowProperties
783 $Value = $this->VXMin + ($i - 1) * (($this->VXMax - $this->VXMin) / $XDivisions);
786 $Value = $this->convertValueForDisplay(
792 $Position = imageftbbox($this->FontSize, $Angle, $this->FontName, $Value);
797 $YPos = $this->GArea_Y2 + 18;
798 $this->canvas->drawText(
799 $this->FontSize,
804 $this->FontName,
806 $this->shadowProperties
809 $YPos = $this->GArea_Y2 + 10 + $TextHeight;
811 $this->canvas->drawText(
812 $this->FontSize,
817 $this->FontName,
819 $this->shadowProperties
822 $this->canvas->drawText(
823 $this->FontSize,
828 $this->FontName,
830 $this->shadowProperties
839 $XPos = $XPos + $this->DivisionWidth;
845 $this->FontSize, 90, $this->FontName,
849 $TextTop = (($this->GArea_Y2 - $this->GArea_Y1) / 2) + $this->GArea_Y1 + ($TextHeight / 2);
850 $this->canvas->drawText(
851 $this->FontSize,
853 new Point($XMin - $this->FontSize,
856 $this->FontName,
858 $this->shadowProperties
863 $this->writeScaleXAxisCaption($Data, $style, $YMax);
867 $LayerHeight = $this->GArea_Y2 - $this->GArea_Y1;
869 $YPos = $LayerHeight - 1; //$this->GArea_Y2-1;
881 $this->canvas->drawFilledRectangle(
882 new Point($this->GArea_X1 + 1,
883 $this->GArea_Y1 + $YPos),
884 new Point($this->GArea_X2 - 1,
885 $this->GArea_Y1 + $LastY),
900 $Position = imageftbbox($this->FontSize, 90, $this->FontName, $data->getDataDescription()->getXAxisName());
902 $TextLeft = (($this->GArea_X2 - $this->GArea_X1) / 2) + $this->GArea_X1 + ($TextWidth / 2);
903 $this->canvas->drawText(
904 $this->FontSize,
907 $YMax + $this->FontSize + 5),
909 $this->FontName,
911 $this->shadowProperties
923 $this->drawGridMosaic($style, $this->DivisionCount, $this->DivisionHeight);
927 $YPos = $this->GArea_Y2 - $this->DivisionHeight;
928 for($i = 1; $i <= $this->DivisionCount; $i++) {
929 if($YPos > $this->GArea_Y1 && $YPos < $this->GArea_Y2)
930 $this->canvas->drawDottedLine(
931 new Point($this->GArea_X1, $YPos),
932 new Point($this->GArea_X2, $YPos),
934 $this->LineWidth,
944 $YPos = $YPos - $this->DivisionHeight;
948 if($this->GAreaXOffset == 0) {
949 $XPos = $this->GArea_X1 + $this->DivisionWidth + $this->GAreaXOffset;
950 $ColCount = $this->DataCount - 2;
952 $XPos = $this->GArea_X1 + $this->GAreaXOffset;
953 $ColCount = floor(($this->GArea_X2 - $this->GArea_X1) / $this->DivisionWidth);
957 if($XPos > $this->GArea_X1 && $XPos < $this->GArea_X2)
958 $this->canvas->drawDottedLine(
959 new Point(floor($XPos), $this->GArea_Y1),
960 new Point(floor($XPos), $this->GArea_Y2),
962 $this->LineWidth,
964 $this->shadowProperties
966 $XPos = $XPos + $this->DivisionWidth;
981 $Position = imageftbbox($this->FontSize, 0, $this->FontName, $Value);
1008 $this->validateDataDescription("drawLegend", $DataDescription);
1017 $Position = imageftbbox($this->FontSize, 0, $this->FontName, $Value);
1029 $this->canvas->drawFilledRoundedRectangle(
1034 $this->LineWidth,
1035 $this->LineDotSize,
1036 $this->shadowProperties
1039 $this->canvas->drawFilledRoundedRectangle(
1044 $this->LineWidth,
1045 $this->LineDotSize,
1046 $this->shadowProperties
1050 $YOffset = 4 + $this->FontSize;
1053 $this->canvas->drawFilledRoundedRectangle(
1059 $this->palette->getColor($ID),
1060 $this->LineWidth,
1061 $this->LineDotSize,
1062 $this->shadowProperties
1064 $this->canvas->drawText(
1065 $this->FontSize,
1070 $this->FontName,
1072 $this->shadowProperties
1075 $Position = imageftbbox($this->FontSize, 0, $this->FontName, $Value);
1087 * this a public function?
1095 $Position = imageftbbox($this->FontSize, 0, $this->FontName, $Value);
1101 $Position = imageftbbox($this->FontSize, 0, $this->FontName, $Value);
1106 $this->canvas->drawText(
1107 $this->FontSize,
1111 $this->FontName,
1136 $Position = imageftbbox($this->FontSize, $Angle, $this->FontName, $Text);
1143 $this->canvas->drawFilledRectangle(
1151 $newPosition = $point1->addIncrement(1, $this->FontSize + 1);
1156 $this->FontSize + 1
1161 $point1->getY() + $this->FontSize + 1);
1194 $this->canvas->drawText($this->FontSize, $Angle, $newPosition, $color, $this->FontName, $Text, $shadowProperties);
1203 $Y = $this->GArea_Y2 - ($Value - $this->VMin) * $this->DivisionRatio;
1205 if($Y <= $this->GArea_Y1 || $Y >= $this->GArea_Y2)
1209 $this->canvas->drawLine(
1210 new Point($this->GArea_X1, $Y),
1211 new Point($this->GArea_X2, $Y),
1213 $this->LineWidth,
1214 $this->LineDotSize,
1215 $this->shadowProperties
1218 $this->canvas->drawDottedLine(
1219 new Point($this->GArea_X1, $Y),
1220 new Point($this->GArea_X2, $Y),
1222 $this->LineWidth,
1224 $this->shadowProperties
1235 $position = new Point($this->GArea_X2 + 2,
1236 $Y + ($this->FontSize / 2));
1238 $position = new Point($this->GArea_X1 + 2,
1239 $Y - ($this->FontSize / 2));
1242 $this->canvas->drawText(
1243 $this->FontSize, 0,
1246 $this->FontName,
1262 $this->validateDataDescription("setLabel", $DataDescription);
1263 $this->validateData("setLabel", $Data);
1277 $XPos = $this->GArea_X1 + $this->GAreaXOffset + ($this->DivisionWidth * $Cp) + 2;
1278 $YPos = $this->GArea_Y2 - ($NumericalValue - $this->VMin) * $this->DivisionRatio;
1280 $Position = imageftbbox($this->FontSize, 0, $this->FontName, $Caption);
1288 $this->canvas->drawFilledPolygon(
1294 $this->canvas->drawLine(
1298 $this->LineWidth,
1299 $this->LineDotSize,
1300 $this->shadowProperties
1303 $this->canvas->drawLine(
1307 $this->LineWidth,
1308 $this->LineDotSize,
1309 $this->shadowProperties
1312 $this->canvas->drawFilledRectangle(
1318 $this->shadowProperties
1324 $this->canvas->drawFilledPolygon($Poly, 3, $color);
1327 * Surely this is pointless? */
1328 $this->canvas->drawLine(
1332 $this->LineWidth,
1333 $this->LineDotSize,
1334 $this->shadowProperties
1337 $this->canvas->drawLine(
1341 $this->LineWidth,
1342 $this->LineDotSize,
1343 $this->shadowProperties
1345 $this->canvas->drawFilledRectangle(
1351 $this->shadowProperties
1354 $this->canvas->drawText(
1355 $this->FontSize,
1359 $this->FontName,
1381 $this->validateDataDescription("drawPlotGraph", $DataDescription);
1382 $this->validateData("drawPlotGraph", $Data);
1390 $color = $this->palette->getColor($ColorID);
1400 $XPos = $this->GArea_X1 + $this->GAreaXOffset;
1406 $YPos = $this->GArea_Y2 - (($Value - $this->VMin) * $this->DivisionRatio);
1409 if($this->BuildMap)
1410 $this->addToImageMap($XPos - $Hsize, $YPos - $Hsize, $XPos + 1 + $Hsize, $YPos + $Hsize + 1, $DataDescription->description[$ColName], $Values[$ColName].$DataDescription->getYUnit(), "Plot");
1417 $this->canvas->drawFilledCircle(
1422 $this->shadowProperties
1425 $color3 = $this->palette->getColor($ColorID)->addRGBIncrement(-20);
1427 $this->canvas->drawFilledCircle(
1432 $this->shadowProperties
1437 $this->canvas->drawFilledCircle(
1442 $this->shadowProperties
1447 $this->canvas->drawFilledCircle(
1452 $this->shadowProperties
1455 $color2 = $this->palette->getColor($ColorID)->addRGBIncrement(-15);
1457 $this->canvas->drawFilledCircle(
1462 $this->shadowProperties
1467 imagecopymerge($this->canvas->getPicture(), $Symbol, $XPos + 1 - $ImageWidth / 2, $YPos + 1 - $ImageHeight / 2, 0, 0, $ImageWidth, $ImageHeight, 100);
1471 $XPos = $XPos + $this->DivisionWidth;
1481 $color = $this->palette->getColor($PaletteID);
1491 $Y = $this->GArea_Y2 - (($Y - $this->VMin) * $this->DivisionRatio);
1492 $X = $this->GArea_X1 + (($X - $this->VXMin) * $this->XDivisionRatio);
1495 $br = $this->linearScale(
1510 $this->canvas->drawFilledCircle(
1514 $this->shadowProperties
1517 $color3 = $this->palette->getColor($PaletteID)->addRGBIncrement(-20);
1518 $this->canvas->drawFilledCircle(
1522 $this->shadowProperties
1527 $this->canvas->drawFilledCircle(
1531 $this->shadowProperties
1535 $this->canvas->drawFilledCircle(
1539 $this->shadowProperties
1542 $color2 = $this->palette->getColor($PaletteID)->addRGBIncrement(20);
1544 $this->canvas->drawFilledCircle(
1548 $this->shadowProperties
1561 $this->validateData("drawArea", $Data);
1563 $LayerHeight = $this->GArea_Y2 - $this->GArea_Y1;
1565 $XPos = $this->GAreaXOffset;
1572 $YPos1 = $LayerHeight - (($Value1 - $this->VMin) * $this->DivisionRatio);
1573 $YPos2 = $LayerHeight - (($Value2 - $this->VMin) * $this->DivisionRatio);
1577 $Points [] = $LastXPos + $this->GArea_X1;
1578 $Points [] = $LastYPos1 + $this->GArea_Y1;
1579 $Points [] = $LastXPos + $this->GArea_X1;
1580 $Points [] = $LastYPos2 + $this->GArea_Y1;
1581 $Points [] = $XPos + $this->GArea_X1;
1582 $Points [] = $YPos2 + $this->GArea_Y1;
1583 $Points [] = $XPos + $this->GArea_X1;
1584 $Points [] = $YPos1 + $this->GArea_Y1;
1586 $this->canvas->drawFilledPolygon(
1598 $XPos = $XPos + $this->DivisionWidth;
1607 $this->validateDataDescription("writeValues", $DataDescription);
1608 $this->validateData("writeValues", $Data);
1617 $XPos = $this->GArea_X1 + $this->GAreaXOffset;
1622 $YPos = $this->GArea_Y2 - (($Value - $this->VMin) * $this->DivisionRatio);
1624 $Positions = imagettfbbox($this->FontSize, 0, $this->FontName, $Value);
1629 $this->canvas->drawText(
1630 $this->FontSize,
1633 $this->palette->getColor($ColorID),
1634 $this->FontName,
1639 $XPos = $XPos + $this->DivisionWidth;
1651 $this->validateDataDescription("drawLineGraph", $DataDescription);
1652 $this->validateData("drawLineGraph", $Data);
1659 $XPos = $this->GArea_X1 + $this->GAreaXOffset;
1665 $YPos = $this->GArea_Y2 - (($Value - $this->VMin) * $this->DivisionRatio);
1668 if($this->BuildMap)
1669 $this->addToImageMap($XPos - 3, $YPos - 3, $XPos + 3, $YPos + 3, $DataDescription->description[$ColName], $Values[$ColName].$DataDescription->getYUnit(), "Line");
1675 $this->canvas->drawLine(
1678 $this->palette->getColor($ColorID),
1679 $this->LineWidth,
1680 $this->LineDotSize,
1681 $this->shadowProperties,
1682 new Point($this->GArea_X1,
1683 $this->GArea_Y1),
1684 new Point($this->GArea_X2,
1685 $this->GArea_Y2)
1694 $XPos = $XPos + $this->DivisionWidth;
1706 $graphAreaMin = new Point($this->GArea_X1, $this->GArea_Y1);
1707 $graphAreaMax = new Point($this->GArea_X2, $this->GArea_Y2);
1716 $Y = $this->GArea_Y2 - (($Y - $this->VMin) * $this->DivisionRatio);
1717 $X = $this->GArea_X1 + (($X - $this->VXMin) * $this->XDivisionRatio);
1722 $this->canvas->drawLine(
1725 $this->palette->getColor($PaletteID),
1726 $this->LineWidth,
1727 $this->LineDotSize,
1728 $this->shadowProperties,
1744 $this->validateDataDescription(
1748 $this->validateData("drawCubicCurve", $data->getData());
1750 $graphAreaMin = new Point($this->GArea_X1, $this->GArea_Y1);
1751 $graphAreaMax = new Point($this->GArea_X2, $this->GArea_Y2);
1779 $this->calculateCubicCurve($Yt, $XIn, $YIn, $U, $Index);
1786 $XPos = $this->GArea_X1 + $this->GAreaXOffset;
1816 * I believe this is the actual cubic Bezier
1826 $YPos = $this->GArea_Y2 - (($Value - $this->VMin) * $this->DivisionRatio);
1829 $this->canvas->drawLine(
1834 $this->palette->getColor($ColorID),
1835 $this->LineWidth,
1836 $this->LineDotSize,
1837 $this->shadowProperties,
1844 $XPos = $XPos + $this->DivisionWidth * $Accuracy;
1848 $XPos = $XPos - $this->DivisionWidth * $Accuracy;
1849 if($XPos < ($this->GArea_X2 - $this->GAreaXOffset)) {
1850 $YPos = $this->GArea_Y2 - (($YIn [$Index] - $this->VMin) * $this->DivisionRatio);
1851 $this->canvas->drawLine(
1854 new Point($this->GArea_X2 - $this->GAreaXOffset,
1856 $this->palette->getColor($ColorID),
1857 $this->LineWidth,
1858 $this->LineDotSize,
1859 $this->shadowProperties,
1871 * @todo I haven't figured out exactly what this bit of code does,
1878 * this ratio will change */
1899 $this->validateDataDescription(
1903 $this->validateData("drawFilledCubicCurve", $data->getData());
1905 $LayerWidth = $this->GArea_X2 - $this->GArea_X1;
1906 $LayerHeight = $this->GArea_Y2 - $this->GArea_Y1;
1907 $YZero = $LayerHeight - ((0 - $this->VMin) * $this->DivisionRatio);
1931 $this->calculateCubicCurve($Yt, $XIn, $YIn, $U, $numElements);
1939 $Points [] = $this->GAreaXOffset + $this->GArea_X1;
1940 $Points [] = $LayerHeight + $this->GArea_Y1;
1943 $XPos = $this->GAreaXOffset;
1963 $YPos = $LayerHeight - (($Value - $this->VMin) * $this->DivisionRatio);
1968 $aPoints [] = $XLast + $this->GArea_X1;
1969 $aPoints [] = min($YLast + $this->GArea_Y1, $this->GArea_Y2);
1970 $aPoints [] = $XPos + $this->GArea_X1;
1971 $aPoints [] = min($YPos + $this->GArea_Y1, $this->GArea_Y2);
1972 $aPoints [] = $XPos + $this->GArea_X1;
1973 $aPoints [] = $YZero + $this->GArea_Y1;
1974 $aPoints [] = $XLast + $this->GArea_X1;
1975 $aPoints [] = $YZero + $this->GArea_Y1;
1977 $this->canvas->drawFilledPolygon(
1980 $this->palette->getColor($ColorID),
1987 $Points [] = $XPos + $this->GArea_X1;
1988 $Points [] = min($YPos + $this->GArea_Y1, $this->GArea_Y2);
1991 $Points [] = $XLast + $this->GArea_X1;
1993 $LayerHeight + $this->GArea_Y1,
1994 $this->GArea_Y2
2001 $XPos = $XPos + $this->DivisionWidth * $Accuracy;
2005 $XPos = $XPos - $this->DivisionWidth * $Accuracy;
2006 if($XPos < ($LayerWidth - $this->GAreaXOffset)) {
2007 $YPos = $LayerHeight - (($YIn [$numElements] - $this->VMin) * $this->DivisionRatio);
2010 $aPoints [] = $XLast + $this->GArea_X1;
2011 $aPoints [] = max($YLast + $this->GArea_Y1, $this->GArea_Y1);
2012 $aPoints [] = $LayerWidth - $this->GAreaXOffset + $this->GArea_X1;
2013 $aPoints [] = max($YPos + $this->GArea_Y1, $this->GArea_Y1);
2014 $aPoints [] = $LayerWidth - $this->GAreaXOffset + $this->GArea_X1;
2015 $aPoints [] = max($YZero + $this->GArea_Y1, $this->GArea_Y1);
2016 $aPoints [] = $XLast + $this->GArea_X1;
2017 $aPoints [] = max($YZero + $this->GArea_Y1, $this->GArea_Y1);
2019 $this->canvas->drawFilledPolygon(
2022 $this->palette->getColor($ColorID),
2030 - $this->GAreaXOffset
2031 + $this->GArea_X1;
2032 $Points [] = $YPos + $this->GArea_Y1;
2036 $Points [] = $LayerWidth - $this->GAreaXOffset + $this->GArea_X1;
2037 $Points [] = $LayerHeight + $this->GArea_Y1;
2040 $this->canvas->drawFilledPolygon(
2043 $this->palette->getColor($ColorID),
2048 $this->drawCubicCurve($data, $Accuracy, $ColName);
2061 $this->validateDataDescription("drawFilledLineGraph", $DataDescription);
2062 $this->validateData("drawFilledLineGraph", $Data);
2064 $LayerWidth = $this->GArea_X2 - $this->GArea_X1;
2065 $LayerHeight = $this->GArea_Y2 - $this->GArea_Y1;
2072 $aPoints [] = $this->GAreaXOffset + $this->GArea_X1;
2073 $aPoints [] = $LayerHeight + $this->GArea_Y1;
2075 $XPos = $this->GAreaXOffset;
2078 $YZero = $LayerHeight - ((0 - $this->VMin) * $this->DivisionRatio);
2086 $YPos = $LayerHeight - (($Value - $this->VMin) * $this->DivisionRatio);
2089 if($this->BuildMap)
2090 $this->addToImageMap($XPos - 3, $YPos - 3, $XPos + 3, $YPos + 3, $DataDescription->description[$ColName], $Data [$Key] [$ColName].$DataDescription->getYUnit(), "FLine");
2094 $aPoints [] = $XLast + $this->GArea_X1;
2095 $aPoints [] = $LayerHeight + $this->GArea_Y1;
2101 $aPoints [] = $XPos + $this->GArea_X1;
2102 $aPoints [] = $YPos + $this->GArea_Y1;
2106 $aPoints [] = $XPos + $this->GArea_X1;
2107 $aPoints [] = $LayerHeight + $this->GArea_Y1;
2108 $aPoints [] = $XPos + $this->GArea_X1;
2109 $aPoints [] = $YPos + $this->GArea_Y1;
2114 $Points [] = $XLast + $this->GArea_X1;
2115 $Points [] = $YLast + $this->GArea_Y1;
2116 $Points [] = $XPos + $this->GArea_X1;
2117 $Points [] = $YPos + $this->GArea_Y1;
2118 $Points [] = $XPos + $this->GArea_X1;
2119 $Points [] = $YZero + $this->GArea_Y1;
2120 $Points [] = $XLast + $this->GArea_X1;
2121 $Points [] = $YZero + $this->GArea_Y1;
2123 $this->canvas->drawFilledPolygon(
2126 $this->palette->getColor($ColorID),
2134 $XPos = $XPos + $this->DivisionWidth;
2136 $aPoints [] = $LayerWidth - $this->GAreaXOffset + $this->GArea_X1;
2137 $aPoints [] = $LayerHeight + $this->GArea_Y1;
2140 $this->canvas->drawFilledPolygon(
2143 $this->palette->getColor($ColorID),
2149 $this->drawLineGraph($Data, $DataDescription, $ColName);
2158 $this->validateDataDescription("drawOverlayBarGraph", $DataDescription);
2159 $this->validateData("drawOverlayBarGraph", $Data);
2161 $LayerHeight = $this->GArea_Y2 - $this->GArea_Y1;
2167 $XWidth = $this->DivisionWidth / 4;
2168 $XPos = $this->GAreaXOffset;
2169 $YZero = $LayerHeight - ((0 - $this->VMin) * $this->DivisionRatio);
2174 $YPos = $LayerHeight - (($Value - $this->VMin) * $this->DivisionRatio);
2176 $this->canvas->drawFilledRectangle(
2177 new Point(floor($XPos - $XWidth + $this->GArea_X1),
2178 floor($YPos + $this->GArea_Y1)),
2179 new Point(floor($XPos + $XWidth + $this->GArea_X1),
2180 floor($YZero + $this->GArea_Y1)),
2181 $this->palette->getColor($GraphID),
2187 $X1 = floor($XPos - $XWidth + $this->GArea_X1);
2188 $Y1 = floor($YPos + $this->GArea_Y1) + .2;
2189 $X2 = floor($XPos + $XWidth + $this->GArea_X1);
2190 $Y2 = $this->GArea_Y2 - ((0 - $this->VMin) * $this->DivisionRatio);
2191 if($X1 <= $this->GArea_X1) {
2192 $X1 = $this->GArea_X1 + 1;
2194 if($X2 >= $this->GArea_X2) {
2195 $X2 = $this->GArea_X2 - 1;
2199 if($this->BuildMap)
2200 $this->addToImageMap($X1, min($Y1, $Y2), $X2, max($Y1, $Y2), $DataDescription->description[$ColName], $Data [$Key] [$ColName].$DataDescription->getYUnit(), "oBar");
2202 $this->canvas->drawLine(
2207 $this->palette->getColor($ColorID),
2208 $this->LineWidth,
2209 $this->LineDotSize,
2210 $this->shadowProperties,
2211 new Point($this->GArea_X1,
2212 $this->GArea_Y1),
2213 new Point($this->GArea_X2,
2214 $this->GArea_Y2)
2218 $XPos = $XPos + $this->DivisionWidth;
2230 $this->validateDataDescription("drawBarGraph", $DataDescription);
2231 $this->validateData("drawBarGraph", $Data);
2234 $SeriesWidth = $this->DivisionWidth / ($Series + 1);
2235 $SerieXOffset = $this->DivisionWidth / 2 - $SeriesWidth / 2;
2237 $YZero = $this->GArea_Y2 - ((0 - $this->VMin) * $this->DivisionRatio);
2238 if($YZero > $this->GArea_Y2) {
2239 $YZero = $this->GArea_Y2;
2247 $XPos = $this->GArea_X1 + $this->GAreaXOffset - $SerieXOffset + $SeriesWidth * $SerieID;
2252 $YPos = $this->GArea_Y2 - (($Value - $this->VMin) * $this->DivisionRatio);
2255 if($this->BuildMap) {
2256 $this->addToImageMap($XPos + 1, min($YZero, $YPos), $XPos + $SeriesWidth - 1, max($YZero, $YPos), $DataDescription->description[$ColName], $Data [$Key] [$ColName].$DataDescription->getYUnit(), "Bar");
2260 $this->canvas->drawRectangle(
2265 $this->LineWidth,
2266 $this->LineDotSize,
2267 $this->shadowProperties
2271 $this->canvas->drawFilledRectangle(
2276 $this->palette->getColor($ColorID),
2277 $this->shadowProperties,
2282 $XPos = $XPos + $this->DivisionWidth;
2293 $this->validateDataDescription("drawBarGraph", $DataDescription);
2294 $this->validateData("drawBarGraph", $Data);
2297 $SeriesWidth = $this->DivisionWidth;
2299 $SeriesWidth = $this->DivisionWidth * .8;
2301 $YZero = $this->GArea_Y2 - ((0 - $this->VMin) * $this->DivisionRatio);
2302 if($YZero > $this->GArea_Y2) {
2303 $YZero = $this->GArea_Y2;
2311 $XPos = $this->GArea_X1 + $this->GAreaXOffset - $SeriesWidth / 2;
2318 $YPos = $this->GArea_Y2 - ((($Value + $LastValue [$Key]) - $this->VMin) * $this->DivisionRatio);
2319 $YBottom = $this->GArea_Y2 - (($LastValue [$Key] - $this->VMin) * $this->DivisionRatio);
2322 $YPos = $this->GArea_Y2 - (($Value - $this->VMin) * $this->DivisionRatio);
2328 if($this->BuildMap)
2329 $this->addToImageMap($XPos + 1, min($YBottom, $YPos), $XPos + $SeriesWidth - 1, max($YBottom, $YPos), $DataDescription->description[$ColName], $Data [$Key] [$ColName].$DataDescription->getYUnit(), "sBar");
2331 $this->canvas->drawFilledRectangle(
2336 $this->palette->getColor($ColorID),
2337 $this->shadowProperties,
2343 $XPos = $XPos + $this->DivisionWidth;
2358 $this->validateDataDescription("drawLimitsGraph", $DataDescription);
2359 $this->validateData("drawLimitsGraph", $Data);
2361 $XWidth = $this->DivisionWidth / 4;
2362 $XPos = $this->GArea_X1 + $this->GAreaXOffset;
2364 $graphAreaMin = new Point($this->GArea_X1, $this->GArea_Y1);
2365 $graphAreaMax = new Point($this->GArea_X2, $this->GArea_Y2);
2389 $YPos = $this->GArea_Y2 - (($Max - $this->VMin) * $this->DivisionRatio);
2393 if($X1 <= $this->GArea_X1) {
2394 $X1 = $this->GArea_X1 + 1;
2396 if($X2 >= $this->GArea_X2) {
2397 $X2 = $this->GArea_X2 - 1;
2400 $YPos = $this->GArea_Y2 - (($Min - $this->VMin) * $this->DivisionRatio);
2403 $this->canvas->drawLine(
2407 $this->LineWidth,
2408 $this->LineDotSize,
2409 $this->shadowProperties,
2413 $this->canvas->drawLine(
2417 $this->LineWidth,
2418 $this->LineDotSize,
2419 $this->shadowProperties,
2423 $this->canvas->drawLine(
2428 $this->palette->getColor($MaxID),
2429 $this->LineWidth,
2430 $this->LineDotSize,
2431 $this->shadowProperties
2433 $this->canvas->drawLine(
2438 $this->palette->getColor($MinID),
2439 $this->LineWidth,
2440 $this->LineDotSize,
2441 $this->shadowProperties
2444 $XPos = $XPos + $this->DivisionWidth;
2461 $this->validateDataDescription("drawRadarAxis", $DataDescription);
2462 $this->validateData("drawRadarAxis", $Data);
2466 $Radius = ($this->GArea_Y2 - $this->GArea_Y1) / 2 - $BorderOffset;
2467 $XCenter = ($this->GArea_X2 - $this->GArea_X1) / 2 + $this->GArea_X1;
2468 $YCenter = ($this->GArea_Y2 - $this->GArea_Y1) / 2 + $this->GArea_Y1;
2511 $this->canvas->drawFilledPolygon(
2538 $this->canvas->drawDottedLine(
2542 $this->shadowProperties
2556 $this->canvas->drawLine(
2560 $this->LineWidth,
2561 $this->LineDotSize,
2562 $this->shadowProperties
2570 $Positions = imagettfbbox($this->FontSize, 0, $this->FontName, $Label);
2586 $this->canvas->drawText(
2587 $this->FontSize,
2591 $this->FontName,
2611 $Positions = imagettfbbox($this->FontSize, 0, $this->FontName, $t);
2613 $Y = $YPos + $this->FontSize;
2615 $this->canvas->drawFilledRoundedRectangle(
2622 $this->LineWidth,
2623 $this->LineDotSize,
2624 $this->shadowProperties
2627 $this->canvas->drawRoundedRectangle(
2634 $this->LineWidth,
2635 $this->LineDotSize,
2636 $this->shadowProperties
2638 $this->canvas->drawText(
2639 $this->FontSize,
2643 $this->FontName,
2668 $this->validateDataDescription("drawRadar", $DataDescription);
2669 $this->validateData("drawRadar", $Data);
2672 $Radius = ($this->GArea_Y2 - $this->GArea_Y1) / 2 - $BorderOffset;
2673 $XCenter = ($this->GArea_X2 - $this->GArea_X1) / 2 + $this->GArea_X1;
2674 $YCenter = ($this->GArea_Y2 - $this->GArea_Y1) / 2 + $this->GArea_Y1;
2678 $MaxValue = $this->calculateMaxValue($Data, $DataDescription);
2697 $this->canvas->drawLine(
2702 $this->palette->getColor($ColorID),
2703 $this->LineWidth,
2704 $this->LineDotSize,
2705 $this->shadowProperties
2718 $this->canvas->drawLine(
2723 $this->palette->getColor($ColorID),
2724 $this->LineWidth,
2725 $this->LineDotSize,
2726 $this->shadowProperties
2737 $this->validateDataDescription("drawFilledRadar", $DataDescription);
2738 $this->validateData("drawFilledRadar", $Data);
2741 $Radius = ($this->GArea_Y2 - $this->GArea_Y1) / 2 - $BorderOffset;
2742 $XCenter = ($this->GArea_X2 - $this->GArea_X1) / 2;
2743 $YCenter = ($this->GArea_Y2 - $this->GArea_Y1) / 2;
2747 $MaxValue = $this->calculateMaxValue($Data, $DataDescription);
2768 $Plots [] = $XPos + $this->GArea_X1;
2769 $Plots [] = $YPos + $this->GArea_Y1;
2780 $this->canvas->drawFilledPolygon(
2783 $this->palette->getColor($ColorID),
2788 $this->canvas->drawLine(
2793 $this->palette->getColor($ColorID),
2794 $this->LineWidth,
2795 $this->LineDotSize,
2796 $this->shadowProperties
2808 $C_Background = $this->canvas->allocateColor($color);
2809 imagefilledrectangle($this->canvas->getPicture(), 0, 0, $this->XSize, $this->YSize, $C_Background);
2824 $this->canvas->drawFilledRectangle(
2841 $this->canvas->drawFilledRectangle(
2865 $this->drawGradient(
2866 new Point($this->GArea_X1 + 1, $this->GArea_Y1 + 1),
2867 new Point($this->GArea_X2 - 1, $this->GArea_Y2),
2874 $this->drawGradient(
2876 new Point($this->XSize, $this->YSize),
2886 $this->canvas->drawCircle(new Point($Xc, $Yc), $Height, $color, $this->shadowProperties, $Width);
2893 $this->canvas->drawFilledCircle(new Point($Xc, $Yc), $Height, $color, $this->shadowProperties, $Width);
2900 $this->drawFromPicture(1, $FileName, $X, $Y, $Alpha);
2907 $this->drawFromPicture(2, $FileName, $X, $Y, $Alpha);
2914 $this->drawFromPicture(3, $FileName, $X, $Y, $Alpha);
2935 imagecopymerge($this->canvas->getPicture(), $Raster, $X, $Y, 0, 0, $Width, $Height, $Alpha);
2946 $Width = $this->XSize + 2 * $Size;
2947 $Height = $this->YSize + 2 * $Size;
2953 imagecopy($Resampled, $this->canvas->getPicture(), $Size, $Size, 0, 0, $this->XSize, $this->YSize);
2954 imagedestroy($this->canvas->getPicture());
2956 $this->XSize = $Width;
2957 $this->YSize = $Height;
2959 $this->canvas->setPicture(imagecreatetruecolor($this->XSize, $this->YSize));
2960 $C_White = $this->canvas->allocate(new Color(255, 255, 255));
2961 imagefilledrectangle($this->canvas->getPicture(), 0, 0, $this->XSize, $this->YSize, $C_White);
2962 imagecolortransparent($this->canvas->getPicture(), $C_White);
2963 imagecopy($this->canvas->getPicture(), $Resampled, 0, 0, 0, 0, $this->XSize, $this->YSize);
2970 if($this->ErrorReporting)
2971 $this->printErrors($this->ErrorInterface);
2974 if($this->BuildMap)
2975 $this->SaveImageMap();
2978 imagepng($this->canvas->getPicture(), $FileName);
2980 imagepng($this->canvas->getPicture());
2988 if($this->ErrorReporting)
2989 $this->printErrors("GD");
2992 if($this->BuildMap)
2993 $this->SaveImageMap();
2996 imagepng($this->canvas->getPicture());
3002 * @todo Should this be a method on DataDescription?
3006 $this->Errors [] = "[Warning] ".$FunctionName." - Y Labels are not set.";
3012 $this->Errors [] = "[Warning] ".$FunctionName." - Series descriptions are not set.";
3019 $this->Errors [] = "[Warning] ".$FunctionName." - Some series descriptions are not set.";
3044 $this->Errors [] = "[Warning] ".$FunctionName." - No data set.";
3048 $this->Errors [] = "[Warning] ".$FunctionName." - Missing data in serie ".$key.".";
3057 if(count($this->Errors) == 0)
3061 foreach($this->Errors as $key => $Value)
3065 foreach($this->Errors as $key => $Value) {
3066 $Position = imageftbbox($this->ErrorFontSize, 0, $this->ErrorFontName, $Value);
3072 $this->canvas->drawFilledRoundedRectangle(
3073 new Point($this->XSize - ($MaxWidth + 20),
3074 $this->YSize - (20 + (($this->ErrorFontSize + 4) * count($this->Errors)))),
3075 new Point($this->XSize - 10,
3076 $this->YSize - 10),
3079 $this->lineWidth,
3080 $this->lineDotSize,
3081 $this->shadowProperties
3084 $this->canvas->drawRoundedRectangle(
3085 new Point($this->XSize - ($MaxWidth + 20),
3086 $this->YSize - (20 + (($this->ErrorFontSize + 4) * count($this->Errors)))),
3087 new Point($this->XSize - 10,
3088 $this->YSize - 10),
3091 $this->LineWidth,
3092 $this->LineDotSize,
3093 $this->shadowProperties
3096 $YPos = $this->YSize - (18 + (count($this->Errors) - 1) * ($this->ErrorFontSize + 4));
3097 foreach($this->Errors as $key => $Value) {
3098 $this->canvas->drawText(
3099 $this->ErrorFontSize,
3101 new Point($this->XSize - ($MaxWidth + 15),
3104 $this->ErrorFontName,
3108 $YPos = $YPos + ($this->ErrorFontSize + 4);
3117 $this->BuildMap = $Mode;
3118 $this->MapID = $GraphID;
3125 if($this->MapFunction == NULL || $this->MapFunction == $CallerFunction) {
3126 $this->ImageMap [] = round($X1).",".round($Y1).",".round($X2).",".round($Y2).",".$SerieName.",".$Value;
3127 $this->MapFunction = $CallerFunction;
3136 $Values = $this->tmpFolder.$MapName;
3160 if(!$this->BuildMap) {
3164 if($this->ImageMap == NULL) {
3165 $this->Errors [] = "[Warning] SaveImageMap - Image map is empty.";
3169 $Handle = fopen($this->tmpFolder.$this->MapID, 'w');
3171 $this->Errors [] = "[Warning] SaveImageMap - Cannot save the image map.";
3174 foreach($this->ImageMap as $Value)
3184 $this->DateFormat = $Format;
3191 return (date($this->DateFormat, $Value));
3204 * @todo I don't know what this does yet, I'm refactoring...
3211 $MaxDivs = ($this->GArea_Y2 - $this->GArea_Y1) / $MinDivHeight;
3213 if($this->VMax <= $this->VMin) {
3217 if($this->VMin == 0 && $this->VMax == 0) {
3218 $this->VMin = 0;
3219 $this->VMax = 2;
3224 $Scale1 = ($this->VMax - $this->VMin) / $Factor;
3225 $Scale2 = ($this->VMax - $this->VMin) / $Factor / 2;
3247 if(floor($this->VMax / $Scale / $Factor) != $this->VMax / $Scale / $Factor) {
3248 $GridID = floor($this->VMax / $Scale / $Factor) + 1;
3249 $this->VMax = $GridID * $Scale * $Factor;
3253 if(floor($this->VMin / $Scale / $Factor) != $this->VMin / $Scale / $Factor) {
3254 $GridID = floor($this->VMin / $Scale / $Factor);
3255 $this->VMin = $GridID * $Scale * $Factor;
3266 return $this->canvas->getPicture();