1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
| <?php
require_once ("jpgraph/jpgraph.php");
require_once ("jpgraph/jpgraph_gantt.php");
$data = array(
array(0,array("Group 1","345 days","2004-03-01","2004-05-05"), "2001-11-27 10:00","2001-11-27 14:00",FF_FONT2,FS_NORMAL,0),
array(1,array(" Label one",' 122,5 days',' 2004-03-01',' 2003-05-05','MJ'), "2001-11-27 16:00","2001-11-27 18:00"),
array(2," Label two", "2001-11-27","2001-11-27 10:00"),
array(3," Label three", "2001-11-27","2001-11-27 08:00")
);
$graph = new GanttGraph();
$graph->SetMarginColor('darkgreen@0.8');
$graph->SetColor('white');
$graph->ShowHeaders(GANTT_HDAY | GANTT_HHOUR | GANTT_HMIN);
$graph->scale->actinfo->SetColTitles(
array('Act','Duration','Start','Finish','Resp'));
$graph->scale->actinfo->SetFont(FF_ARIAL,FS_NORMAL,10);
$graph->scale->actinfo->vgrid->SetColor('gray');
$graph->scale->actinfo->SetColor('darkgray');
$graph->scale->day->SetBackgroundColor('lightyellow:1.5');
$graph->scale->day->SetFont(FF_ARIAL);
$graph->scale->day->SetStyle(DAYSTYLE_SHORTDAYDATE1);
$graph->scale->hour->SetIntervall(1);
$graph->scale->hour->SetBackgroundColor('lightyellow:1.5');
$graph->scale->hour->SetFont(FF_FONT0);
$graph->scale->hour->SetStyle(HOURSTYLE_H24);
$graph->scale->hour->grid->SetColor('gray:0.8');
$graph->scale->minute->SetIntervall(30);
$graph->scale->minute->SetBackgroundColor('lightyellow:1.5');
$graph->scale->minute->SetFont(FF_FONT0);
$graph->scale->minute->SetStyle(MINUTESTYLE_MM);
$graph->scale->minute->grid->SetColor('lightgray');
$graph->scale->tableTitle->Set('Phase 1');
$graph->scale->tableTitle->SetFont(FF_ARIAL,FS_NORMAL,12);
$graph->scale->SetTableTitleBackground('darkgreen@0.6');
$graph->scale->tableTitle->Show(true);
$graph->title->Set("Example of hours & mins scale");
$graph->title->SetColor('darkgray');
$graph->title->SetFont(FF_VERDANA,FS_BOLD,14);
for($i=0; $i<count($data); ++$i) {
$bar = new GanttBar($data[$i][0],$data[$i][1],$data[$i][2],$data[$i][3]);
if( count($data[$i])>4 )
$bar->title->SetFont($data[$i][4],$data[$i][5],$data[$i][6]);
$bar->SetPattern(BAND_RDIAG,"yellow");
$bar->SetFillColor("gray");
$graph->Add($bar);
}
$vline = new GanttVLine("2001-11-27 9:00");
$vline->SetWeight(5);
$vline->SetDayOffset(0);
$vline->title->Set("27/11 9:00");
$vline->title->SetFont(FF_FONT1,FS_BOLD,10);
$graph->Add($vline);
$graph->Stroke();
?> |