~josephjamesmills/zpanelcp/zpanel_new

« back to all changes in this revision

Viewing changes to var/www/zpanel/lib/pChart2/examples/example.drawBubbleChart.php

  • Committer: Joseph Mills
  • Date: 2012-07-08 21:41:44 UTC
  • Revision ID: josephjamesmills@gmail.com-20120708214144-5umjr8wu2i2k33ey
clened up some of the css added new apache rouncube and alot more stuff.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<?php
 
2
 /* CAT:Bubble 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
 include("../class/pBubble.class.php");
 
9
 
 
10
 /* Create and populate the pData object */
 
11
 $MyData = new pData();
 
12
 $MyData->loadPalette("../palettes/summer.color",TRUE);
 
13
 $MyData->addPoints(array(34,55,15,62,38,42),"Probe1");
 
14
 $MyData->addPoints(array(5,10,8,9,15,10),"Probe1Weight");
 
15
 $MyData->addPoints(array(5,10,-5,-1,0,-10),"Probe2");
 
16
 $MyData->addPoints(array(6,10,14,10,14,6),"Probe2Weight");
 
17
 $MyData->setSerieDescription("Probe1","This year");
 
18
 $MyData->setSerieDescription("Probe2","Last year");
 
19
 $MyData->setAxisName(0,"Current stock");
 
20
 $MyData->addPoints(array("Apple","Banana","Orange","Lemon","Peach","Strawberry"),"Product");
 
21
 $MyData->setAbscissa("Product");
 
22
 
 
23
 /* Create the pChart object */
 
24
 $myPicture = new pImage(700,230,$MyData);
 
25
 
 
26
 /* Draw the background */
 
27
 $Settings = array("R"=>170, "G"=>183, "B"=>87, "Dash"=>1, "DashR"=>190, "DashG"=>203, "DashB"=>107);
 
28
 $myPicture->drawFilledRectangle(0,0,700,230,$Settings);
 
29
 
 
30
 /* Overlay with a gradient */
 
31
 $Settings = array("StartR"=>219, "StartG"=>231, "StartB"=>139, "EndR"=>1, "EndG"=>138, "EndB"=>68, "Alpha"=>50);
 
32
 $myPicture->drawGradientArea(0,0,700,230,DIRECTION_VERTICAL,$Settings);
 
33
 $myPicture->drawGradientArea(0,0,700,20,DIRECTION_VERTICAL,array("StartR"=>0,"StartG"=>0,"StartB"=>0,"EndR"=>50,"EndG"=>50,"EndB"=>50,"Alpha"=>80));
 
34
 
 
35
 /* Add a border to the picture */
 
36
 $myPicture->drawRectangle(0,0,699,229,array("R"=>0,"G"=>0,"B"=>0));
 
37
 
 
38
 /* Write the picture title */ 
 
39
 $myPicture->setFontProperties(array("FontName"=>"../fonts/Silkscreen.ttf","FontSize"=>6));
 
40
 $myPicture->drawText(10,13,"drawBubbleChart() - draw a linear bubble chart",array("R"=>255,"G"=>255,"B"=>255));
 
41
 
 
42
 /* Write the title */
 
43
 $myPicture->setFontProperties(array("FontName"=>"../fonts/Forgotte.ttf","FontSize"=>11));
 
44
 $myPicture->drawText(40,55,"Current Stock / Needs chart",array("FontSize"=>14,"Align"=>TEXT_ALIGN_BOTTOMLEFT));
 
45
 
 
46
 /* Change the default font */
 
47
 $myPicture->setFontProperties(array("FontName"=>"../fonts/pf_arma_five.ttf","FontSize"=>6));
 
48
 
 
49
 /* Create the Bubble chart object and scale up */
 
50
 $myBubbleChart = new pBubble($myPicture,$MyData);
 
51
 
 
52
 /* Scale up for the bubble chart */
 
53
 $bubbleDataSeries   = array("Probe1","Probe2");
 
54
 $bubbleWeightSeries = array("Probe1Weight","Probe2Weight");
 
55
 $myBubbleChart->bubbleScale($bubbleDataSeries,$bubbleWeightSeries);
 
56
 
 
57
 /* Draw the 1st chart */
 
58
 $myPicture->setGraphArea(40,60,430,190);
 
59
 $myPicture->drawFilledRectangle(40,60,430,190,array("R"=>255,"G"=>255,"B"=>255,"Surrounding"=>-50,"Alpha"=>10));
 
60
 $myPicture->drawScale(array("DrawSubTicks"=>TRUE,"CycleBackground"=>TRUE));
 
61
 $myPicture->setShadow(TRUE,array("X"=>1,"Y"=>1,"R"=>0,"G"=>0,"B"=>0,"Alpha"=>30));
 
62
 $myBubbleChart->drawBubbleChart($bubbleDataSeries,$bubbleWeightSeries);
 
63
 
 
64
 /* Draw the 2nd scale */
 
65
 $myPicture->setShadow(FALSE);
 
66
 $myPicture->setGraphArea(500,60,670,190);
 
67
 $myPicture->drawFilledRectangle(500,60,670,190,array("R"=>255,"G"=>255,"B"=>255,"Surrounding"=>-200,"Alpha"=>10));
 
68
 $myPicture->drawScale(array("Pos"=>SCALE_POS_TOPBOTTOM,"DrawSubTicks"=>TRUE));
 
69
 
 
70
 /* Draw the 2nd stock chart */
 
71
 $myPicture->setShadow(TRUE,array("X"=>1,"Y"=>1,"R"=>0,"G"=>0,"B"=>0,"Alpha"=>30));
 
72
 $myBubbleChart->drawbubbleChart($bubbleDataSeries,$bubbleWeightSeries,array("DrawBorder"=>TRUE,"Surrounding"=>60,"BorderAlpha"=>100));
 
73
 
 
74
 /* Write the chart legend */
 
75
 $myPicture->drawLegend(550,215,array("Style"=>LEGEND_NOBORDER,"Mode"=>LEGEND_HORIZONTAL));
 
76
 
 
77
 /* Render the picture (choose the best way) */
 
78
 $myPicture->autoOutput("pictures/example.drawBubbleChart.png");
 
79
?>
 
 
b'\\ No newline at end of file'