Subversion-Projekte lars-tiefland.php_share

Revision

Details | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
1 lars 1
<?php
2
include ("../jpgraph.php");
3
include ("../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,"auto");
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