source: trunk/web/addons/job_monarch/lib/pchart/Example22.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.9 KB
Line 
1<?php   
2 /*
3     Example22 : Customizing plot graphs
4 */
5
6 // Standard inclusions
7 include("pChart/pData.class");
8 include("pChart/pChart.class");
9 
10 // Dataset definition
11 $DataSet = new pData;
12 $DataSet->AddPoint(array(60,70,90,110,100,90),"Serie1");
13 $DataSet->AddPoint(array(40,50,60,80,70,60),"Serie2");
14 $DataSet->AddPoint(array("Jan","Feb","Mar","Apr","May","Jun"),"Serie3");
15 $DataSet->AddSerie("Serie1");
16 $DataSet->AddSerie("Serie2");
17 $DataSet->SetAbsciseLabelSerie("Serie3");
18 $DataSet->SetSerieName("Company A","Serie1");
19 $DataSet->SetSerieName("Company B","Serie2");
20 $DataSet->SetYAxisName("Product sales");
21 $DataSet->SetYAxisUnit("k");
22 $DataSet->SetSerieSymbol("Serie1","Sample/Point_Asterisk.gif");
23 $DataSet->SetSerieSymbol("Serie2","Sample/Point_Cd.gif");
24
25 // Initialise the graph   
26 $Test = new pChart(700,230);
27 $Test->setFontProperties("Fonts/tahoma.ttf",8);
28 $Test->setGraphArea(65,30,650,200);
29 $Test->drawFilledRoundedRectangle(7,7,693,223,5,240,240,240);
30 $Test->drawRoundedRectangle(5,5,695,225,5,230,230,230);
31 $Test->drawGraphArea(255,255,255,TRUE);
32 $Test->drawScale($DataSet->GetData(),$DataSet->GetDataDescription(),SCALE_NORMAL,150,150,150,TRUE,0,2,TRUE);
33 $Test->drawGrid(4,TRUE,230,230,230,50);
34 
35 // Draw the title
36 $Test->setFontProperties("Fonts/pf_arma_five.ttf",6);
37 $Title = "Comparative product sales for company A & B  ";
38 $Test->drawTextBox(65,30,650,45,$Title,0,255,255,255,ALIGN_RIGHT,TRUE,0,0,0,30);
39 
40 // Draw the line graph
41 $Test->drawLineGraph($DataSet->GetData(),$DataSet->GetDataDescription());
42 $Test->drawPlotGraph($DataSet->GetData(),$DataSet->GetDataDescription(),3,2,255,255,255);
43 
44 // Draw the legend
45 $Test->setFontProperties("Fonts/tahoma.ttf",8);
46 $Test->drawLegend(80,60,$DataSet->GetDataDescription(),255,255,255);
47
48 // Render the chart
49 $Test->Render("example22.png");
50?>
Note: See TracBrowser for help on using the repository browser.