source: trunk/web/addons/job_monarch/lib/pchart/Example11.php @ 647

Last change on this file since 647 was 619, checked in by ramonb, 15 years ago

lib/:

  • added new AJAX dependancies: ExtJS, pChart, Lightbox2
File size: 1.7 KB
Line 
1<?php
2 /*
3     Example11 : Using the pCache class
4 */
5
6 // Standard inclusions   
7 include("pChart/pData.class");
8 include("pChart/pChart.class");
9 include("pChart/pCache.class");
10
11 // Dataset definition
12 $DataSet = new pData;
13 $DataSet->AddPoint(array(1,4,3,2,3,3,2,1,0,7,4,3,2,3,3,5,1,0,7),"Serie1");
14 $DataSet->AddPoint(array(1,4,2,6,2,3,0,1,5,1,2,4,5,2,1,0,6,4,2),"Serie2");
15 $DataSet->AddAllSeries();
16 $DataSet->SetAbsciseLabelSerie();
17 $DataSet->SetSerieName("January","Serie1");
18 $DataSet->SetSerieName("February","Serie2");
19
20 // Cache definition
21 $Cache = new pCache();
22 $Cache->GetFromCache("Graph1",$DataSet->GetData());
23
24 // Initialise the graph
25 $Test = new pChart(700,230);
26 $Test->setFontProperties("Fonts/tahoma.ttf",8);
27 $Test->setGraphArea(50,30,585,200);
28 $Test->drawFilledRoundedRectangle(7,7,693,223,5,240,240,240);
29 $Test->drawRoundedRectangle(5,5,695,225,5,230,230,230);
30 $Test->drawGraphArea(255,255,255,TRUE);
31 $Test->drawScale($DataSet->GetData(),$DataSet->GetDataDescription(),SCALE_NORMAL,150,150,150,TRUE,0,2);
32 $Test->drawGrid(4,TRUE,230,230,230,50);
33
34 // Draw the 0 line
35 $Test->setFontProperties("Fonts/tahoma.ttf",6);
36 $Test->drawTreshold(0,143,55,72,TRUE,TRUE);
37
38 // Draw the cubic curve graph
39 $Test->drawCubicCurve($DataSet->GetData(),$DataSet->GetDataDescription());
40
41 // Finish the graph
42 $Test->setFontProperties("Fonts/tahoma.ttf",8);
43 $Test->drawLegend(600,30,$DataSet->GetDataDescription(),255,255,255);
44 $Test->setFontProperties("Fonts/tahoma.ttf",10);
45 $Test->drawTitle(50,22,"Example 1",50,50,50,585);
46
47 // Render the graph
48 $Cache->WriteToCache("Graph1",$DataSet->GetData(),$Test);
49 $Test->Render("example1.png");
50?>
Note: See TracBrowser for help on using the repository browser.