| 1 |
lars |
1 |
<?php
|
|
|
2 |
// Gantt example
|
|
|
3 |
include ("../jpgraph.php");
|
|
|
4 |
include ("../jpgraph_gantt.php");
|
|
|
5 |
|
|
|
6 |
//
|
|
|
7 |
// The data for the graphs
|
|
|
8 |
//
|
|
|
9 |
$data = array(
|
|
|
10 |
array(0,ACTYPE_GROUP, "Phase 1", "2001-10-26","2001-11-23",''),
|
|
|
11 |
array(1,ACTYPE_NORMAL, " Label 1", "2001-10-26","2001-11-18",''),
|
|
|
12 |
array(2,ACTYPE_NORMAL, " Label 2", "2001-10-26","2001-11-16",''),
|
|
|
13 |
array(3,ACTYPE_NORMAL, " Label 3", "2001-11-20","2001-11-22",''),
|
|
|
14 |
array(4,ACTYPE_MILESTONE," Phase 1 Done", "2001-11-23",'M2') );
|
|
|
15 |
|
|
|
16 |
// The constrains between the activities
|
|
|
17 |
$constrains = array(array(1,2,CONSTRAIN_ENDSTART),
|
|
|
18 |
array(1,3,CONSTRAIN_STARTSTART),
|
|
|
19 |
array(3,4,CONSTRAIN_STARTSTART));
|
|
|
20 |
|
|
|
21 |
$progress = array(array(1,0.4));
|
|
|
22 |
|
|
|
23 |
// Create the basic graph
|
|
|
24 |
$graph = new GanttGraph();
|
|
|
25 |
$graph->title->Set("Example with grouping and constrains");
|
|
|
26 |
|
|
|
27 |
// Setup scale
|
|
|
28 |
$graph->ShowHeaders(GANTT_HYEAR | GANTT_HMONTH | GANTT_HDAY | GANTT_HWEEK);
|
|
|
29 |
$graph->scale->week->SetStyle(WEEKSTYLE_FIRSTDAYWNBR);
|
|
|
30 |
|
|
|
31 |
// Add the specified activities
|
|
|
32 |
$graph->CreateSimple($data,$constrains,$progress);
|
|
|
33 |
|
|
|
34 |
// .. and stroke the graph
|
|
|
35 |
$graph->Stroke();
|
|
|
36 |
|
|
|
37 |
?>
|
|
|
38 |
|
|
|
39 |
|