1 | <?php // content="text/plain; charset=utf-8" |
---|
2 | require_once ('jpgraph/jpgraph.php'); |
---|
3 | require_once ('jpgraph/jpgraph_pie.php'); |
---|
4 | |
---|
5 | // Some data |
---|
6 | $data = array(40,21,17,14,23); |
---|
7 | |
---|
8 | // Create the Pie Graph. |
---|
9 | $graph = new PieGraph(500,300); |
---|
10 | $graph->SetShadow(); |
---|
11 | |
---|
12 | $theme_class= new UniversalTheme; |
---|
13 | //$graph->SetTheme($theme_class); |
---|
14 | |
---|
15 | // Set A title for the plot |
---|
16 | $graph->title->Set("Multiple - Pie plot"); |
---|
17 | |
---|
18 | // Create plots |
---|
19 | $size=0.13; |
---|
20 | $p1 = new PiePlot($data); |
---|
21 | $graph->Add($p1); |
---|
22 | |
---|
23 | $p1->SetSize($size); |
---|
24 | $p1->SetCenter(0.25,0.32); |
---|
25 | $p1->SetSliceColors(array('#1E90FF','#2E8B57','#ADFF2F','#DC143C','#BA55D3')); |
---|
26 | $p1->title->Set("2005"); |
---|
27 | |
---|
28 | $p2 = new PiePlot($data); |
---|
29 | $graph->Add($p2); |
---|
30 | |
---|
31 | $p2->SetSize($size); |
---|
32 | $p2->SetCenter(0.65,0.32); |
---|
33 | $p2->SetSliceColors(array('#1E90FF','#2E8B57','#ADFF2F','#DC143C','#BA55D3')); |
---|
34 | $p2->title->Set("2006"); |
---|
35 | |
---|
36 | $p3 = new PiePlot($data); |
---|
37 | $graph->Add($p3); |
---|
38 | |
---|
39 | $p3->SetSize($size); |
---|
40 | $p3->SetCenter(0.25,0.75); |
---|
41 | $p3->SetSliceColors(array('#6495ED','#2E8B57','#ADFF2F','#DC143C','#BA55D3')); |
---|
42 | $p3->title->Set("2007"); |
---|
43 | |
---|
44 | $p4 = new PiePlot($data); |
---|
45 | $graph->Add($p4); |
---|
46 | |
---|
47 | $p4->SetSize($size); |
---|
48 | $p4->SetCenter(0.65,0.75); |
---|
49 | $p4->SetSliceColors(array('#6495ED','#2E8B57','#ADFF2F','#DC143C','#BA55D3')); |
---|
50 | $p4->title->Set("2008"); |
---|
51 | |
---|
52 | |
---|
53 | $graph->Stroke(); |
---|
54 | |
---|
55 | ?> |
---|