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 |
|
---|
14 | // Set A title for the plot
|
---|
15 | $graph->title->Set("Example 2 3D Pie plot");
|
---|
16 | $graph->title->SetFont(FF_VERDANA,FS_BOLD,18);
|
---|
17 | $graph->title->SetColor("darkblue");
|
---|
18 | $graph->legend->Pos(0.1,0.2);
|
---|
19 |
|
---|
20 | // Create 3D pie plot
|
---|
21 | $p1 = new PiePlot3d($data);
|
---|
22 | $p1->SetTheme("sand");
|
---|
23 | $p1->SetCenter(0.4);
|
---|
24 | $p1->SetSize(0.4);
|
---|
25 | $p1->SetHeight(5);
|
---|
26 |
|
---|
27 | // Adjust projection angle
|
---|
28 | $p1->SetAngle(45);
|
---|
29 |
|
---|
30 | // You can explode several slices by specifying the explode
|
---|
31 | // distance for some slices in an array
|
---|
32 | $p1->Explode(array(0,40,0,30));
|
---|
33 |
|
---|
34 | // As a shortcut you can easily explode one numbered slice with
|
---|
35 | // $p1->ExplodeSlice(3);
|
---|
36 |
|
---|
37 | $p1->value->SetFont(FF_ARIAL,FS_NORMAL,10);
|
---|
38 | $p1->SetLegends(array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct"));
|
---|
39 |
|
---|
40 | $graph->Add($p1);
|
---|
41 | $graph->Stroke();
|
---|
42 |
|
---|
43 | ?>
|
---|
44 |
|
---|
45 |
|
---|