[42] | 1 | <?php // content="text/plain; charset=utf-8"
|
---|
| 2 | // Gantt example
|
---|
| 3 | require_once ('jpgraph/jpgraph.php');
|
---|
| 4 | require_once ('jpgraph/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 2", "2001-10-26","2001-11-16",''),
|
---|
| 12 | array(2,ACTYPE_NORMAL, " Label 3", "2001-11-20","2001-11-22",''),
|
---|
| 13 | array(3,ACTYPE_NORMAL, " Label 4", "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_ENDEND),
|
---|
| 18 | array(2,3,CONSTRAIN_STARTEND),
|
---|
| 19 | array(3,4,CONSTRAIN_ENDSTART),
|
---|
| 20 | );
|
---|
| 21 |
|
---|
| 22 | $progress = array(array(1,0.4));
|
---|
| 23 |
|
---|
| 24 | // Create the basic graph
|
---|
| 25 | $graph = new GanttGraph();
|
---|
| 26 | $graph->title->Set("Example with grouping and constrains");
|
---|
| 27 |
|
---|
| 28 | // Setup scale
|
---|
| 29 | $graph->ShowHeaders(GANTT_HYEAR | GANTT_HMONTH | GANTT_HDAY | GANTT_HWEEK);
|
---|
| 30 | $graph->scale->week->SetStyle(WEEKSTYLE_FIRSTDAYWNBR);
|
---|
| 31 |
|
---|
| 32 | // Add the specified activities
|
---|
| 33 | $graph->CreateSimple($data,$constrains,$progress);
|
---|
| 34 |
|
---|
| 35 | // .. and stroke the graph
|
---|
| 36 | $graph->Stroke();
|
---|
| 37 |
|
---|
| 38 | ?>
|
---|
| 39 |
|
---|
| 40 |
|
---|