[42] | 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 5 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 | // Display the slice values
|
---|
| 32 | $p1->value->SetFont(FF_ARIAL,FS_BOLD,11);
|
---|
| 33 | $p1->value->SetColor("navy");
|
---|
| 34 |
|
---|
| 35 | // Add colored edges to the 3D pie
|
---|
| 36 | // NOTE: You can't have exploded slices with edges!
|
---|
| 37 | $p1->SetEdge("navy");
|
---|
| 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 |
|
---|