4
/* pChart library inclusions */
5
include("../class/pData.class.php");
6
include("../class/pDraw.class.php");
7
include("../class/pImage.class.php");
9
/* Create and populate the pData object */
10
$MyData = new pData();
11
for($i=0;$i<=30;$i++) { $MyData->addPoints(rand(1,15),"Probe 1"); }
12
$MyData->setSerieTicks("Probe 2",4);
13
$MyData->setAxisName(0,"Temperatures");
15
/* Create the pChart object */
16
$myPicture = new pImage(700,230,$MyData);
18
/* Turn of Antialiasing */
19
$myPicture->Antialias = FALSE;
21
/* Add a border to the picture */
22
$myPicture->drawGradientArea(0,0,700,230,DIRECTION_VERTICAL,array("StartR"=>240,"StartG"=>240,"StartB"=>240,"EndR"=>180,"EndG"=>180,"EndB"=>180,"Alpha"=>100));
23
$myPicture->drawGradientArea(0,0,700,230,DIRECTION_HORIZONTAL,array("StartR"=>240,"StartG"=>240,"StartB"=>240,"EndR"=>180,"EndG"=>180,"EndB"=>180,"Alpha"=>20));
25
/* Add a border to the picture */
26
$myPicture->drawRectangle(0,0,699,229,array("R"=>0,"G"=>0,"B"=>0));
28
/* Write the chart title */
29
$myPicture->setFontProperties(array("FontName"=>"../fonts/Forgotte.ttf","FontSize"=>11));
30
$myPicture->drawText(150,35,"Average temperature",array("FontSize"=>20,"Align"=>TEXT_ALIGN_BOTTOMMIDDLE));
32
/* Set the default font */
33
$myPicture->setFontProperties(array("FontName"=>"../fonts/pf_arma_five.ttf","FontSize"=>6));
35
/* Define the chart area */
36
$myPicture->setGraphArea(60,40,650,200);
39
$scaleSettings = array("XMargin"=>10,"YMargin"=>10,"Floating"=>TRUE,"GridR"=>200,"GridG"=>200,"GridB"=>200,"GridAlpha"=>100,"DrawSubTicks"=>TRUE,"CycleBackground"=>TRUE);
40
$myPicture->drawScale($scaleSettings);
42
/* Write the chart legend */
43
$myPicture->drawLegend(640,20,array("Style"=>LEGEND_NOBORDER,"Mode"=>LEGEND_HORIZONTAL));
45
/* Turn on Antialiasing */
46
$myPicture->Antialias = TRUE;
48
/* Enable shadow computing */
49
$myPicture->setShadow(TRUE,array("X"=>1,"Y"=>1,"R"=>0,"G"=>0,"B"=>0,"Alpha"=>10));
51
/* Draw the area chart */
53
$Threshold[] = array("Min"=>0,"Max"=>5,"R"=>187,"G"=>220,"B"=>0,"Alpha"=>100);
54
$Threshold[] = array("Min"=>5,"Max"=>10,"R"=>240,"G"=>132,"B"=>20,"Alpha"=>100);
55
$Threshold[] = array("Min"=>10,"Max"=>20,"R"=>240,"G"=>91,"B"=>20,"Alpha"=>100);
56
$myPicture->setShadow(TRUE,array("X"=>1,"Y"=>1,"R"=>0,"G"=>0,"B"=>0,"Alpha"=>20));
57
$myPicture->drawAreaChart(array("Threshold"=>$Threshold));
59
/* Draw a line chart over */
60
$myPicture->drawLineChart(array("ForceColor"=>TRUE,"ForceR"=>0,"ForceG"=>0,"ForceB"=>0));
62
/* Draw a plot chart over */
63
$myPicture->drawPlotChart(array("PlotBorder"=>TRUE,"BorderSize"=>1,"Surrounding"=>-255,"BorderAlpha"=>80));
65
/* Write the thresholds */
66
$myPicture->drawThreshold(5,array("WriteCaption"=>TRUE,"Caption"=>"Warn Zone","Alpha"=>70,"Ticks"=>2,"R"=>0,"G"=>0,"B"=>255));
67
$myPicture->drawThreshold(10,array("WriteCaption"=>TRUE,"Caption"=>"Error Zone","Alpha"=>70,"Ticks"=>2,"R"=>0,"G"=>0,"B"=>255));
69
/* Render the picture (choose the best way) */
70
$myPicture->autoOutput("pictures/example.drawAreaChart.threshold.png");
b'\\ No newline at end of file'