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

Last change on this file since 42 was 42, checked in by marrucho, 10 years ago
File size: 1.0 KB
Line 
1<?php // content="text/plain; charset=utf-8"
2require_once ('jpgraph/jpgraph.php');
3require_once ('jpgraph/jpgraph_pie.php');
4
5// Some data
6$data = array(27,23,47,17);
7
8// A new graph
9$graph = new PieGraph(350,200);
10$graph->SetShadow();
11
12// Setup title
13$graph->title->Set("Example of pie plot with absolute labels");
14$graph->title->SetFont(FF_FONT1,FS_BOLD);
15
16// The pie plot
17$p1 = new PiePlot($data);
18
19// Move center of pie to the left to make better room
20// for the legend
21$p1->SetCenter(0.35,0.5);
22
23// No border
24$p1->ShowBorder(false);
25
26// Label font and color setup
27$p1->value->SetFont(FF_FONT1,FS_BOLD);
28$p1->value->SetColor("darkred");
29
30// Use absolute values (type==1)
31$p1->SetLabelType(PIE_VALUE_ABS);
32
33// Label format
34$p1->value->SetFormat("$%d");
35$p1->value->Show();
36
37// Size of pie in fraction of the width of the graph
38$p1->SetSize(0.3);
39
40// Legends
41$p1->SetLegends(array("May ($%d)","June ($%d)","July ($%d)","Aug ($%d)"));
42$graph->legend->Pos(0.05,0.15);
43
44$graph->Add($p1);
45$graph->Stroke();
46?>
47
48
Note: See TracBrowser for help on using the repository browser.