[42] | 1 | <?php // content="text/plain; charset=utf-8"
|
---|
| 2 | // $Id: ganttex_slice.php,v 1.2 2002/07/11 23:27:28 aditus Exp $
|
---|
| 3 | // Gantt example with sunday week start and only shows a partial graph
|
---|
| 4 | require_once ('jpgraph/jpgraph.php');
|
---|
| 5 | require_once ('jpgraph/jpgraph_gantt.php');
|
---|
| 6 |
|
---|
| 7 | // Setup Gantt graph
|
---|
| 8 | $graph = new GanttGraph(0,0,'auto');
|
---|
| 9 | $graph->SetShadow();
|
---|
| 10 | $graph->SetBox();
|
---|
| 11 |
|
---|
| 12 | // Only show part of the Gantt
|
---|
| 13 | $graph->SetDateRange('2001-11-22','2002-1-24');
|
---|
| 14 |
|
---|
| 15 | // Weeks start on Sunday
|
---|
| 16 | $graph->scale->SetWeekStart(0);
|
---|
| 17 |
|
---|
| 18 | $graph->title->Set("General conversion plan");
|
---|
| 19 | $graph->subtitle->Set("(Slice between 2001-11-22 to 2002-01-24)");
|
---|
| 20 | $graph->title->SetFont(FF_ARIAL,FS_BOLD,20);
|
---|
| 21 |
|
---|
| 22 | $graph->ShowHeaders(GANTT_HYEAR | GANTT_HMONTH | GANTT_HDAY | GANTT_HWEEK);
|
---|
| 23 | $graph->scale->week->SetStyle(WEEKSTYLE_FIRSTDAY);
|
---|
| 24 | $graph->scale->week->SetFont(FF_FONT1);
|
---|
| 25 |
|
---|
| 26 |
|
---|
| 27 | $data = array(
|
---|
| 28 | array(0,"Group 1\tJohan", "2002-1-23","2002-01-28",FF_FONT1,FS_BOLD,8),
|
---|
| 29 | array(1," Label 2", "2001-10-26","2001-11-16"),
|
---|
| 30 | array(2," Label 3", "2001-11-30","2001-12-01"),
|
---|
| 31 | array(4,"Group 2", "2001-11-30","2001-12-22",FF_FONT1,FS_BOLD,8),
|
---|
| 32 | array(5," Label 4", "2001-11-30","2001-12-1"),
|
---|
| 33 | array(6," Label 5", "2001-12-6","2001-12-8"),
|
---|
| 34 | array(8," Label 8", "2001-11-30","2002-01-02")
|
---|
| 35 | );
|
---|
| 36 |
|
---|
| 37 |
|
---|
| 38 | // make up some fictionary activity bars
|
---|
| 39 | for($i=0; $i<count($data); ++$i) {
|
---|
| 40 | $bar = new GanttBar($data[$i][0],$data[$i][1],$data[$i][2],$data[$i][3],"[5%]",10);
|
---|
| 41 | if( count($data[$i])>4 )
|
---|
| 42 | $bar->title->SetFont($data[$i][4],$data[$i][5],$data[$i][6]);
|
---|
| 43 |
|
---|
| 44 | $bar->rightMark->Show();
|
---|
| 45 | $bar->rightMark->SetType(MARK_FILLEDCIRCLE);
|
---|
| 46 | $bar->rightMark->SetWidth(8);
|
---|
| 47 | $bar->rightMark->SetColor("red");
|
---|
| 48 | $bar->rightMark->SetFillColor("red");
|
---|
| 49 | $bar->rightMark->title->Set($i+1);
|
---|
| 50 | $bar->rightMark->title->SetFont(FF_ARIAL,FS_BOLD,12);
|
---|
| 51 | $bar->rightMark->title->SetColor("white");
|
---|
| 52 |
|
---|
| 53 | $bar->SetPattern(BAND_RDIAG,"yellow");
|
---|
| 54 | $bar->SetFillColor("red");
|
---|
| 55 | $bar->progress->Set($i/10);
|
---|
| 56 | $bar->progress->SetPattern(GANTT_SOLID,"darkgreen");
|
---|
| 57 |
|
---|
| 58 | $graph->Add($bar);
|
---|
| 59 | }
|
---|
| 60 |
|
---|
| 61 |
|
---|
| 62 | // The line will NOT be shown since it is outside the specified slice
|
---|
| 63 | $vline = new GanttVLine("2002-02-28");
|
---|
| 64 | $vline->title->Set("2002-02-28");
|
---|
| 65 | $vline->title->SetFont(FF_FONT1,FS_BOLD,10);
|
---|
| 66 | $graph->Add($vline);
|
---|
| 67 |
|
---|
| 68 | // The milestone will NOT be shown since it is outside the specified slice
|
---|
| 69 | $ms = new MileStone(7,"M5","2002-01-28","28/1");
|
---|
| 70 | $ms->title->SetFont(FF_FONT1,FS_BOLD);
|
---|
| 71 | $graph->Add($ms);
|
---|
| 72 |
|
---|
| 73 | $graph->Stroke();
|
---|
| 74 |
|
---|
| 75 |
|
---|
| 76 | ?>
|
---|
| 77 |
|
---|
| 78 |
|
---|