1 | <?php // content="text/plain; charset=utf-8" |
---|
2 | require_once ('jpgraph/jpgraph.php'); |
---|
3 | require_once ('jpgraph/jpgraph_pie.php'); |
---|
4 | require_once ('jpgraph/jpgraph_pie3d.php'); |
---|
5 | |
---|
6 | // Some data |
---|
7 | $data = array(20,27,45,75,90); |
---|
8 | |
---|
9 | // Create the Pie Graph. |
---|
10 | $graph = new PieGraph(350,200); |
---|
11 | $graph->SetShadow(); |
---|
12 | |
---|
13 | // Set A title for the plot |
---|
14 | $graph->title->Set("Example 4 3D Pie plot"); |
---|
15 | $graph->title->SetFont(FF_VERDANA,FS_BOLD,18); |
---|
16 | $graph->title->SetColor("darkblue"); |
---|
17 | $graph->legend->Pos(0.1,0.2); |
---|
18 | |
---|
19 | // Create 3D pie plot |
---|
20 | $p1 = new PiePlot3d($data); |
---|
21 | $p1->SetTheme("sand"); |
---|
22 | $p1->SetCenter(0.4); |
---|
23 | $p1->SetSize(80); |
---|
24 | |
---|
25 | // Adjust projection angle |
---|
26 | $p1->SetAngle(45); |
---|
27 | |
---|
28 | // Adjsut angle for first slice |
---|
29 | $p1->SetStartAngle(45); |
---|
30 | |
---|
31 | // As a shortcut you can easily explode one numbered slice with |
---|
32 | $p1->ExplodeSlice(3); |
---|
33 | |
---|
34 | // Setup slice values |
---|
35 | $p1->value->SetFont(FF_ARIAL,FS_BOLD,11); |
---|
36 | $p1->value->SetColor("navy"); |
---|
37 | |
---|
38 | |
---|
39 | $p1->SetLegends(array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct")); |
---|
40 | |
---|
41 | $graph->Add($p1); |
---|
42 | $graph->Stroke(); |
---|
43 | |
---|
44 | ?> |
---|
45 | |
---|
46 | |
---|