source: trunk/xgraph/jpgraph/Examples/pielabelsex2.php @ 42

Last change on this file since 42 was 42, checked in by marrucho, 10 years ago
File size: 928 bytes
Line 
1<?php // content="text/plain; charset=utf-8"
2require_once ('jpgraph/jpgraph.php');
3require_once ('jpgraph/jpgraph_pie.php');
4
5$data = array(19,12,4,3,3,12,3,3,5,6,7,8,8,1,7,2,2,4,6,8,21,23,2,2,12);
6
7// Create the Pie Graph.
8$graph = new PieGraph(300,350);
9
10// Set A title for the plot
11$graph->title->Set("Label guide lines");
12$graph->title->SetFont(FF_VERDANA,FS_BOLD,12); 
13$graph->title->SetColor("darkblue");
14$graph->legend->Pos(0.1,0.2);
15
16
17// Create pie plot
18$p1 = new PiePlot($data);
19$p1->SetCenter(0.5,0.55);
20$p1->SetSize(0.3);
21
22// Enable and set policy for guide-lines. Make labels line up vertically
23$p1->SetGuideLines(true,false);
24$p1->SetGuideLinesAdjust(1.5);
25
26// Setup the labels
27$p1->SetLabelType(PIE_VALUE_PER);       
28$p1->value->Show();                     
29$p1->value->SetFont(FF_ARIAL,FS_NORMAL,9);     
30$p1->value->SetFormat('%2.1f%%');               
31
32// Add and stroke
33$graph->Add($p1);
34$graph->Stroke();
35
36?>
37
38
Note: See TracBrowser for help on using the repository browser.