| 1 |
lars |
1 |
<?php
|
|
|
2 |
// Gantt hour example
|
|
|
3 |
include ("../jpgraph.php");
|
|
|
4 |
include ("../jpgraph_gantt.php");
|
|
|
5 |
|
|
|
6 |
$graph = new GanttGraph();
|
|
|
7 |
$graph->SetMarginColor('blue:1.7');
|
|
|
8 |
$graph->SetColor('white');
|
|
|
9 |
|
|
|
10 |
$graph->SetBackgroundGradient('navy','white',GRAD_HOR,BGRAD_MARGIN);
|
|
|
11 |
$graph->scale->hour->SetBackgroundColor('lightyellow:1.5');
|
|
|
12 |
$graph->scale->hour->SetFont(FF_FONT1);
|
|
|
13 |
$graph->scale->day->SetBackgroundColor('lightyellow:1.5');
|
|
|
14 |
$graph->scale->day->SetFont(FF_FONT1,FS_BOLD);
|
|
|
15 |
|
|
|
16 |
$graph->title->Set("Example of hours in scale");
|
|
|
17 |
$graph->title->SetColor('white');
|
|
|
18 |
$graph->title->SetFont(FF_VERDANA,FS_BOLD,14);
|
|
|
19 |
|
|
|
20 |
$graph->ShowHeaders(GANTT_HDAY | GANTT_HHOUR);
|
|
|
21 |
|
|
|
22 |
$graph->scale->week->SetStyle(WEEKSTYLE_FIRSTDAY);
|
|
|
23 |
$graph->scale->week->SetFont(FF_FONT1);
|
|
|
24 |
$graph->scale->hour->SetIntervall(4);
|
|
|
25 |
|
|
|
26 |
$graph->scale->hour->SetStyle(HOURSTYLE_HM24);
|
|
|
27 |
$graph->scale->day->SetStyle(DAYSTYLE_SHORTDAYDATE3);
|
|
|
28 |
|
|
|
29 |
$data = array(
|
|
|
30 |
array(0," Label 1", "2001-01-26 04:00","2001-01-26 14:00"),
|
|
|
31 |
array(1," Label 2", "2001-01-26 10:00","2001-01-26 18:00"),
|
|
|
32 |
array(2," Label 3", "2001-01-26","2001-01-27 10:00")
|
|
|
33 |
);
|
|
|
34 |
|
|
|
35 |
|
|
|
36 |
for($i=0; $i<count($data); ++$i) {
|
|
|
37 |
$bar = new GanttBar($data[$i][0],$data[$i][1],$data[$i][2],$data[$i][3],"[5%]",10);
|
|
|
38 |
if( count($data[$i])>4 )
|
|
|
39 |
$bar->title->SetFont($data[$i][4],$data[$i][5],$data[$i][6]);
|
|
|
40 |
$bar->SetPattern(BAND_RDIAG,"yellow");
|
|
|
41 |
$bar->SetFillColor("red");
|
|
|
42 |
$graph->Add($bar);
|
|
|
43 |
}
|
|
|
44 |
|
|
|
45 |
$graph->Stroke();
|
|
|
46 |
|
|
|
47 |
|
|
|
48 |
|
|
|
49 |
?>
|
|
|
50 |
|
|
|
51 |
|