[42] | 1 | <?php // content="text/plain; charset=utf-8"
|
---|
| 2 | require_once ('jpgraph/jpgraph.php');
|
---|
| 3 | require_once ('jpgraph/jpgraph_gantt.php');
|
---|
| 4 |
|
---|
| 5 | $graph = new GanttGraph();
|
---|
| 6 | $graph->SetShadow();
|
---|
| 7 |
|
---|
| 8 | // Add title and subtitle
|
---|
| 9 | $graph->title->Set("Example of captions");
|
---|
| 10 | $graph->title->SetFont(FF_ARIAL,FS_BOLD,12);
|
---|
| 11 | $graph->subtitle->Set("(ganttex13.php)");
|
---|
| 12 |
|
---|
| 13 | // Show day, week and month scale
|
---|
| 14 | $graph->ShowHeaders(GANTT_HDAY | GANTT_HWEEK | GANTT_HMONTH);
|
---|
| 15 |
|
---|
| 16 | // Instead of week number show the date for the first day in the week
|
---|
| 17 | // on the week scale
|
---|
| 18 | $graph->scale->week->SetStyle(WEEKSTYLE_FIRSTDAY);
|
---|
| 19 |
|
---|
| 20 | // Make the week scale font smaller than the default
|
---|
| 21 | $graph->scale->week->SetFont(FF_FONT0);
|
---|
| 22 |
|
---|
| 23 | // Use the short name of the month together with a 2 digit year
|
---|
| 24 | // on the month scale
|
---|
| 25 | $graph->scale->month->SetStyle(MONTHSTYLE_SHORTNAMEYEAR4);
|
---|
| 26 | $graph->scale->month->SetFontColor("white");
|
---|
| 27 | $graph->scale->month->SetBackgroundColor("blue");
|
---|
| 28 |
|
---|
| 29 | // 0 % vertical label margin
|
---|
| 30 | $graph->SetLabelVMarginFactor(1); // 1=default value
|
---|
| 31 |
|
---|
| 32 | // Format the bar for the first activity
|
---|
| 33 | // ($row,$title,$startdate,$enddate)
|
---|
| 34 | $activity1 = new GanttBar(0,"Activity 1","2001-12-21","2002-01-07","[ER,TR]");
|
---|
| 35 |
|
---|
| 36 | // Yellow diagonal line pattern on a red background
|
---|
| 37 | $activity1->SetPattern(BAND_RDIAG,"yellow");
|
---|
| 38 | $activity1->SetFillColor("red");
|
---|
| 39 |
|
---|
| 40 | // Set absolute height of activity
|
---|
| 41 | $activity1->SetHeight(16);
|
---|
| 42 |
|
---|
| 43 | // Format the bar for the second activity
|
---|
| 44 | // ($row,$title,$startdate,$enddate)
|
---|
| 45 | $activity2 = new GanttBar(1,"Activity 2","2001-12-21","2002-01-01","[BO,SW,JC]");
|
---|
| 46 |
|
---|
| 47 | // ADjust font for caption
|
---|
| 48 | $activity2->caption->SetFont(FF_ARIAL,FS_BOLD);
|
---|
| 49 | $activity2->caption->SetColor("darkred");
|
---|
| 50 |
|
---|
| 51 | // Yellow diagonal line pattern on a red background
|
---|
| 52 | $activity2->SetPattern(BAND_RDIAG,"yellow");
|
---|
| 53 | $activity2->SetFillColor("red");
|
---|
| 54 |
|
---|
| 55 | // Set absolute height of activity
|
---|
| 56 | $activity2->SetHeight(16);
|
---|
| 57 |
|
---|
| 58 | // Finally add the bar to the graph
|
---|
| 59 | $graph->Add($activity1);
|
---|
| 60 | $graph->Add($activity2);
|
---|
| 61 |
|
---|
| 62 | // ... and display it
|
---|
| 63 | $graph->Stroke();
|
---|
| 64 | ?>
|
---|