source: trunk/web/addons/job_monarch/lib/pchart/Example24.php @ 619

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

lib/:

  • added new AJAX dependancies: ExtJS, pChart, Lightbox2
File size: 1.6 KB
Line 
1<?php
2 /*
3     Example24 : X versus Y chart
4 */
5
6 // Standard inclusions   
7 include("pChart/pData.class");
8 include("pChart/pChart.class");
9
10 // Dataset definition
11 $DataSet = new pData;
12
13 // Compute the points
14 for($i=0;$i<=360;$i=$i+10)
15  {
16   $DataSet->AddPoint(cos($i*3.14/180)*80+$i,"Serie1");
17   $DataSet->AddPoint(sin($i*3.14/180)*80+$i,"Serie2");
18  }
19
20 $DataSet->SetSerieName("Trigonometric function","Serie1");
21 $DataSet->AddSerie("Serie1");
22 $DataSet->AddSerie("Serie2");
23 $DataSet->SetXAxisName("X Axis");
24 $DataSet->SetYAxisName("Y Axis");
25
26 // Initialise the graph
27 $Test = new pChart(300,300);
28 $Test->drawGraphAreaGradient(0,0,0,-100,TARGET_BACKGROUND);
29
30 // Prepare the graph area
31 $Test->setFontProperties("Fonts/tahoma.ttf",8);
32 $Test->setGraphArea(55,30,270,230);
33 $Test->drawXYScale($DataSet->GetData(),$DataSet->GetDataDescription(),"Serie1","Serie2",213,217,221,TRUE,45);
34 $Test->drawGraphArea(213,217,221,FALSE);
35 $Test->drawGraphAreaGradient(30,30,30,-50);
36 $Test->drawGrid(4,TRUE,230,230,230,20);
37
38 // Draw the chart
39 $Test->setShadowProperties(2,2,0,0,0,60,4);
40 $Test->drawXYGraph($DataSet->GetData(),$DataSet->GetDataDescription(),"Serie1","Serie2",0);
41 $Test->clearShadow();
42
43 // Draw the title
44 $Title = "Drawing X versus Y charts trigonometric functions  ";
45 $Test->drawTextBox(0,280,300,300,$Title,0,255,255,255,ALIGN_RIGHT,TRUE,0,0,0,30);
46
47 // Draw the legend
48 $Test->setFontProperties("Fonts/pf_arma_five.ttf",6);
49 $DataSet->RemoveSerie("Serie2");
50 $Test->drawLegend(160,5,$DataSet->GetDataDescription(),0,0,0,0,0,0,255,255,255,FALSE);
51
52 $Test->Render("example24.png");
53?>
Note: See TracBrowser for help on using the repository browser.