[42] | 1 | <?php // content="text/plain; charset=utf-8"
|
---|
| 2 | require_once ('jpgraph/jpgraph.php');
|
---|
| 3 | require_once ('jpgraph/jpgraph_gantt.php');
|
---|
| 4 | require_once ('jpgraph/jpgraph_flags.php');
|
---|
| 5 |
|
---|
| 6 | $graph = new GanttGraph();
|
---|
| 7 | $graph->SetBox();
|
---|
| 8 | $graph->SetShadow();
|
---|
| 9 |
|
---|
| 10 | // Add title and subtitle
|
---|
| 11 | $graph->title->Set("Example of captions");
|
---|
| 12 | $graph->title->SetFont(FF_ARIAL,FS_BOLD,12);
|
---|
| 13 | $graph->subtitle->Set("(ganttex17.php)");
|
---|
| 14 |
|
---|
| 15 | // Show day, week and month scale
|
---|
| 16 | $graph->ShowHeaders(GANTT_HDAY | GANTT_HWEEK | GANTT_HMONTH);
|
---|
| 17 |
|
---|
| 18 | // Set table title
|
---|
| 19 | $graph->scale->tableTitle->Set("(Rev: 1.22)");
|
---|
| 20 | $graph->scale->tableTitle->SetFont(FF_FONT1,FS_BOLD);
|
---|
| 21 | $graph->scale->SetTableTitleBackground("silver");
|
---|
| 22 |
|
---|
| 23 | // Modify the appearance of the dividing lines
|
---|
| 24 | $graph->scale->divider->SetWeight(3);
|
---|
| 25 | $graph->scale->divider->SetColor("navy");
|
---|
| 26 | $graph->scale->dividerh->SetWeight(3);
|
---|
| 27 | $graph->scale->dividerh->SetColor("navy");
|
---|
| 28 |
|
---|
| 29 | // Use the short name of the month together with a 2 digit year
|
---|
| 30 | // on the month scale
|
---|
| 31 | $graph->scale->month->SetStyle(MONTHSTYLE_SHORTNAMEYEAR2);
|
---|
| 32 | $graph->scale->month->SetFontColor("white");
|
---|
| 33 | $graph->scale->month->SetBackgroundColor("blue");
|
---|
| 34 |
|
---|
| 35 | // 0 % vertical label margin
|
---|
| 36 | $graph->SetLabelVMarginFactor(1);
|
---|
| 37 |
|
---|
| 38 | // Format the bar for the first activity
|
---|
| 39 | // ($row,$title,$startdate,$enddate)
|
---|
| 40 | $activity = new GanttBar(0,"Project","2001-12-21","2002-01-07","[50%]");
|
---|
| 41 |
|
---|
| 42 | // Yellow diagonal line pattern on a red background
|
---|
| 43 | $activity->SetPattern(BAND_RDIAG,"yellow");
|
---|
| 44 | $activity->SetFillColor("red");
|
---|
| 45 |
|
---|
| 46 | // Set absolute height
|
---|
| 47 | $activity->SetHeight(10);
|
---|
| 48 |
|
---|
| 49 | // Specify progress to 60%
|
---|
| 50 | $activity->progress->Set(0.6);
|
---|
| 51 | $activity->progress->SetPattern(BAND_HVCROSS,"blue");
|
---|
| 52 |
|
---|
| 53 | // Format the bar for the second activity
|
---|
| 54 | // ($row,$title,$startdate,$enddate)
|
---|
| 55 | $activity2 = new GanttBar(1,"Project","2001-12-21","2002-01-02","[30%]");
|
---|
| 56 |
|
---|
| 57 | // Yellow diagonal line pattern on a red background
|
---|
| 58 | $activity2->SetPattern(BAND_RDIAG,"yellow");
|
---|
| 59 | $activity2->SetFillColor("red");
|
---|
| 60 |
|
---|
| 61 | // Set absolute height
|
---|
| 62 | $activity2->SetHeight(10);
|
---|
| 63 |
|
---|
| 64 | // Specify progress to 30%
|
---|
| 65 | $activity2->progress->Set(0.3);
|
---|
| 66 | $activity2->progress->SetPattern(BAND_HVCROSS,"blue");
|
---|
| 67 |
|
---|
| 68 | // Finally add the bar to the graph
|
---|
| 69 | $graph->Add($activity);
|
---|
| 70 | $graph->Add($activity2);
|
---|
| 71 |
|
---|
| 72 | // Add a coutnry flag
|
---|
| 73 | $icon = new IconPlot();
|
---|
| 74 | $icon->SetAnchor('left','top');
|
---|
| 75 | $icon->SetCountryFlag('norway');
|
---|
| 76 | $icon->SetMix(50);
|
---|
| 77 | $icon->SetPos(5,5);
|
---|
| 78 | $graph->Add($icon);
|
---|
| 79 |
|
---|
| 80 |
|
---|
| 81 | // Add a vertical line
|
---|
| 82 | $vline = new GanttVLine("2001-12-24","Phase 1");
|
---|
| 83 | $vline->SetDayOffset(0.5);
|
---|
| 84 | //$graph->Add($vline);
|
---|
| 85 |
|
---|
| 86 | // ... and display it
|
---|
| 87 | $graph->Stroke();
|
---|
| 88 | ?>
|
---|