~josephjamesmills/zpanelcp/zpanelcp

« back to all changes in this revision

Viewing changes to debian/zpanelx/etc/zpanel/lib/pChart2/examples/imageMap/scripts/StockChart.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
 
 /* Library settings */
3
 
 define("CLASS_PATH", "../../../class");
4
 
 define("FONT_PATH", "../../../fonts");
5
 
 
6
 
 /* pChart library inclusions */
7
 
 include(CLASS_PATH."/pData.class.php");
8
 
 include(CLASS_PATH."/pDraw.class.php");
9
 
 include(CLASS_PATH."/pImage.class.php");
10
 
 include(CLASS_PATH."/pStock.class.php");
11
 
 
12
 
 /* Create and populate the pData object */
13
 
 $MyData = new pData();  
14
 
 $MyData->addPoints(array(35,28,17,27,12,12,20,15,20,28),"Open");
15
 
 $MyData->addPoints(array(20,17,25,20,25,23,16,29,26,17),"Close");
16
 
 $MyData->addPoints(array(10,11,14,11,9,4,3,7,9,5),"Min");
17
 
 $MyData->addPoints(array(37,32,33,29,29,25,22,34,29,31),"Max");
18
 
 $MyData->addPoints(array(30,20,21,24,22,18,18,24,22,24),"Median");
19
 
 $MyData->setAxisDisplay(0,AXIS_FORMAT_CURRENCY,"$");
20
 
 
21
 
 $MyData->addPoints(array("Dec 13","Dec 14","Dec 15","Dec 16","Dec 17", "Dec 20","Dec 21","Dec 22","Dec 23","Dec 24"),"Time");
22
 
 $MyData->setAbscissa("Time");
23
 
 $MyData->setAbscissaName("Time");
24
 
 
25
 
 /* Create the pChart object */
26
 
 $myPicture = new pImage(700,230,$MyData);
27
 
 
28
 
 /* Retrieve the image map */
29
 
 if (isset($_GET["ImageMap"]) || isset($_POST["ImageMap"]))
30
 
  $myPicture->dumpImageMap("ImageMapStockChart",IMAGE_MAP_STORAGE_FILE,"StockChart","../tmp");
31
 
 
32
 
 /* Set the image map name */
33
 
 $myPicture->initialiseImageMap("ImageMapStockChart",IMAGE_MAP_STORAGE_FILE,"StockChart","../tmp");
34
 
 
35
 
 /* Turn of AAliasing */
36
 
 $myPicture->Antialias = FALSE;
37
 
 
38
 
 /* Draw the border */
39
 
 $myPicture->drawRectangle(0,0,699,229,array("R"=>0,"G"=>0,"B"=>0));
40
 
 
41
 
 $myPicture->setFontProperties(array("FontName"=>FONT_PATH."/pf_arma_five.ttf","FontSize"=>6));
42
 
 
43
 
 /* Define the chart area */
44
 
 $myPicture->setGraphArea(60,30,650,190);
45
 
 
46
 
 /* Draw the scale */
47
 
 $scaleSettings = array("GridR"=>200,"GridG"=>200,"GridB"=>200,"DrawSubTicks"=>TRUE,"CycleBackground"=>TRUE);
48
 
 $myPicture->drawScale($scaleSettings);
49
 
 
50
 
 /* Create the pStock object */
51
 
 $mystockChart = new pStock($myPicture,$MyData);
52
 
 
53
 
 /* Draw the stock chart */
54
 
 $stockSettings = array("RecordImageMap"=>TRUE,"BoxUpR"=>255,"BoxUpG"=>255,"BoxUpB"=>255,"BoxDownR"=>0,"BoxDownG"=>0,"BoxDownB"=>0,"SerieMedian"=>"Median");
55
 
 $mystockChart->drawStockChart($stockSettings);
56
 
 
57
 
 /* Render the picture (choose the best way) */
58
 
 $myPicture->autoOutput("../tmp/StockChart.png");
59
 
?>
 
 
b'\\ No newline at end of file'