Subversion-Projekte lars-tiefland.php_share

Revision

Details | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
1 lars 1
<?php
2
// Gantt example
3
include ("../jpgraph.php");
4
include ("../jpgraph_gantt.php");
5
 
6
// Basic Gantt graph
7
$graph = new GanttGraph();
8
$graph->title->Set("Using the builtin icons");
9
 
10
// Explicitely set the date range
11
// (Autoscaling will of course also work)
12
$graph->SetDateRange('2001-10-06','2002-4-10');
13
 
14
 
15
// 1.5 line spacing to make more room
16
$graph->SetVMarginFactor(1.5);
17
 
18
// Setup some nonstandard colors
19
$graph->SetMarginColor('lightgreen@0.8');
20
$graph->SetBox(true,'yellow:0.6',2);
21
$graph->SetFrame(true,'darkgreen',4);
22
$graph->scale->divider->SetColor('yellow:0.6');
23
$graph->scale->dividerh->SetColor('yellow:0.6');
24
 
25
// Display month and year scale with the gridlines
26
$graph->ShowHeaders(GANTT_HMONTH | GANTT_HYEAR);
27
$graph->scale->month->grid->SetColor('gray');
28
$graph->scale->month->grid->Show(true);
29
$graph->scale->year->grid->SetColor('gray');
30
$graph->scale->year->grid->Show(true);
31
 
32
// For the titles we also add a minimum width of 100 pixels for the Task name column
33
$graph->scale->actinfo->SetColTitles(
34
    array('Note','Task','Duration','Start','Finish'),array(30,100));
35
$graph->scale->actinfo->SetBackgroundColor('green:0.5@0.5');
36
$graph->scale->actinfo->SetFont(FF_ARIAL,FS_NORMAL,10);
37
$graph->scale->actinfo->vgrid->SetStyle('solid');
38
$graph->scale->actinfo->vgrid->SetColor('gray');
39
 
40
// Uncomment this to keep the columns but show no headers
41
//$graph->scale->actinfo->Show(false);
42
 
43
// Setup the icons we want to use
44
$erricon = new IconImage(GICON_FOLDER,0.6);
45
$startconicon = new IconImage(GICON_FOLDEROPEN,0.6);
46
$endconicon = new IconImage(GICON_TEXTIMPORTANT,0.5);
47
 
48
// Store the icons in the first column and use plain text in the others
49
$data = array(
50
	array(0,array($erricon,"Pre-study","102 days","23 Nov '01","1 Mar '02")
51
	      , "2001-11-23","2002-03-1",FF_ARIAL,FS_NORMAL,8),
52
	array(1,array($startconicon,"Prototype","21 days","26 Oct '01","16 Nov '01"),
53
	      "2001-10-26","2001-11-16",FF_ARIAL,FS_NORMAL,8),
54
	array(2,array($endconicon,"Report","12 days","1 Mar '02","13 Mar '02"),
55
	      "2002-03-01","2002-03-13",FF_ARIAL,FS_NORMAL,8)
56
);
57
 
58
// Create the bars and add them to the gantt chart
59
for($i=0; $i<count($data); ++$i) {
60
	$bar = new GanttBar($data[$i][0],$data[$i][1],$data[$i][2],$data[$i][3],"[50%]",10);
61
	if( count($data[$i])>4 )
62
		$bar->title->SetFont($data[$i][4],$data[$i][5],$data[$i][6]);
63
	$bar->SetPattern(BAND_RDIAG,"yellow");
64
	$bar->SetFillColor("gray");
65
	$bar->progress->Set(0.5);
66
	$bar->progress->SetPattern(GANTT_SOLID,"darkgreen");
67
	$bar->title->SetCSIMTarget(array('#1'.$i,'#2'.$i,'#3'.$i,'#4'.$i,'#5'.$i),array('11'.$i,'22'.$i,'33'.$i));
68
	$graph->Add($bar);
69
}
70
 
71
// Output the chart
72
$graph->Stroke();
73
 
74
?>
75
 
76