~josephjamesmills/zpanelcp/zpanelcp

« back to all changes in this revision

Viewing changes to debian/zpanelx/etc/zpanel/lib/pChart2/examples/example.drawAreaChart.threshold.php

  • Committer: Joseph Mills
  • Date: 2012-05-09 02:52:32 UTC
  • Revision ID: josephjamesmills@gmail.com-20120509025232-ob5xni0ggrse28c0
setup framwork for www

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
<?php   
2
 
 /* CAT:Area Chart */
3
 
 
4
 
 /* pChart library inclusions */
5
 
 include("../class/pData.class.php");
6
 
 include("../class/pDraw.class.php");
7
 
 include("../class/pImage.class.php");
8
 
 
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");
14
 
 
15
 
 /* Create the pChart object */
16
 
 $myPicture = new pImage(700,230,$MyData);
17
 
 
18
 
 /* Turn of Antialiasing */
19
 
 $myPicture->Antialias = FALSE;
20
 
 
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));
24
 
 
25
 
 /* Add a border to the picture */
26
 
 $myPicture->drawRectangle(0,0,699,229,array("R"=>0,"G"=>0,"B"=>0));
27
 
 
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));
31
 
 
32
 
 /* Set the default font */
33
 
 $myPicture->setFontProperties(array("FontName"=>"../fonts/pf_arma_five.ttf","FontSize"=>6));
34
 
 
35
 
 /* Define the chart area */
36
 
 $myPicture->setGraphArea(60,40,650,200);
37
 
 
38
 
 /* Draw the scale */
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);
41
 
 
42
 
 /* Write the chart legend */
43
 
 $myPicture->drawLegend(640,20,array("Style"=>LEGEND_NOBORDER,"Mode"=>LEGEND_HORIZONTAL));
44
 
 
45
 
 /* Turn on Antialiasing */
46
 
 $myPicture->Antialias = TRUE;
47
 
 
48
 
 /* Enable shadow computing */
49
 
 $myPicture->setShadow(TRUE,array("X"=>1,"Y"=>1,"R"=>0,"G"=>0,"B"=>0,"Alpha"=>10));
50
 
 
51
 
 /* Draw the area chart */
52
 
 $Threshold = "";
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));
58
 
 
59
 
 /* Draw a line chart over */
60
 
 $myPicture->drawLineChart(array("ForceColor"=>TRUE,"ForceR"=>0,"ForceG"=>0,"ForceB"=>0));
61
 
 
62
 
 /* Draw a plot chart over */
63
 
 $myPicture->drawPlotChart(array("PlotBorder"=>TRUE,"BorderSize"=>1,"Surrounding"=>-255,"BorderAlpha"=>80));
64
 
 
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));
68
 
  
69
 
 /* Render the picture (choose the best way) */
70
 
 $myPicture->autoOutput("pictures/example.drawAreaChart.threshold.png");
71
 
?>
 
 
b'\\ No newline at end of file'