| 1 |
lars |
1 |
<?php
|
|
|
2 |
// Gantt horizontal grid example
|
|
|
3 |
include ("../jpgraph.php");
|
|
|
4 |
include ("../jpgraph_gantt.php");
|
|
|
5 |
|
|
|
6 |
|
|
|
7 |
// Some dummy data for some activities
|
|
|
8 |
$data = array(
|
|
|
9 |
array(0,"Group 1 Johan", "2001-10-23","2001-11-06",FF_FONT1,FS_BOLD,8),
|
|
|
10 |
array(1," Label 2", "2001-10-26","2001-11-04"),
|
|
|
11 |
array(3,"Group 2", "2001-11-20","2001-11-28",FF_FONT1,FS_BOLD,8),
|
|
|
12 |
array(4," Label 1", "2001-11-20","2001-12-1"));
|
|
|
13 |
|
|
|
14 |
// New Gantt Graph
|
|
|
15 |
$graph = new GanttGraph(500);
|
|
|
16 |
|
|
|
17 |
// Setup a title
|
|
|
18 |
$graph->title->Set("Grid example");
|
|
|
19 |
$graph->subtitle->Set("(Horizontal grid)");
|
|
|
20 |
$graph->title->SetFont(FF_VERDANA,FS_NORMAL,14);
|
|
|
21 |
|
|
|
22 |
// Specify what headers to show
|
|
|
23 |
$graph->ShowHeaders(GANTT_HMONTH|GANTT_HDAY );
|
|
|
24 |
$graph->scale->week->SetStyle(WEEKSTYLE_FIRSTDAY);
|
|
|
25 |
$graph->scale->week->SetFont(FF_FONT0);
|
|
|
26 |
|
|
|
27 |
// Setup a horizontal grid
|
|
|
28 |
$graph->hgrid->Show();
|
|
|
29 |
$graph->hgrid->SetRowFillColor('darkblue@0.9');
|
|
|
30 |
|
|
|
31 |
|
|
|
32 |
for($i=0; $i<count($data); ++$i) {
|
|
|
33 |
$bar = new GanttBar($data[$i][0],$data[$i][1],$data[$i][2],$data[$i][3],"[5%]",10);
|
|
|
34 |
if( count($data[$i]) > 4 )
|
|
|
35 |
$bar->title->SetFont($data[$i][4],$data[$i][5],$data[$i][6]);
|
|
|
36 |
$bar->SetPattern(BAND_RDIAG,"yellow");
|
|
|
37 |
$bar->SetFillColor("red");
|
|
|
38 |
$graph->Add($bar);
|
|
|
39 |
}
|
|
|
40 |
|
|
|
41 |
// Setup a vertical marker line
|
|
|
42 |
$vline = new GanttVLine("2001-11-01");
|
|
|
43 |
$vline->SetDayOffset(0.5);
|
|
|
44 |
$vline->title->Set("2001-11-01");
|
|
|
45 |
$vline->title->SetFont(FF_FONT1,FS_BOLD,10);
|
|
|
46 |
$graph->Add($vline);
|
|
|
47 |
|
|
|
48 |
// Setup a milestone
|
|
|
49 |
$ms = new MileStone(6,"M5","2001-11-28","28/12");
|
|
|
50 |
$ms->title->SetFont(FF_FONT1,FS_BOLD);
|
|
|
51 |
$graph->Add($ms);
|
|
|
52 |
|
|
|
53 |
// And to show that you can also add an icon we add "Tux"
|
|
|
54 |
$icon = new IconPlot('penguin.png',0.01,0.95,1,15);
|
|
|
55 |
$icon->SetAnchor('left','bottom');
|
|
|
56 |
$graph->Add($icon);
|
|
|
57 |
|
|
|
58 |
// .. and finally send it back to the browser
|
|
|
59 |
$graph->Stroke();
|
|
|
60 |
|
|
|
61 |
?>
|
|
|
62 |
|
|
|
63 |
|