[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("Activities on same row");
|
---|
| 10 | $graph->title->SetFont(FF_ARIAL,FS_BOLD,12);
|
---|
| 11 | $graph->subtitle->Set('Using break style');
|
---|
| 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","2001-12-26","");
|
---|
| 35 |
|
---|
| 36 | // Yellow diagonal line pattern on a red background
|
---|
| 37 | $activity1->SetPattern(BAND_RDIAG,"yellow");
|
---|
| 38 | $activity1->SetFillColor("red");
|
---|
| 39 |
|
---|
| 40 | // Format the bar for the first activity
|
---|
| 41 | // ($row,$title,$startdate,$enddate)
|
---|
| 42 | $break1 = new GanttBar(0,'',"2001-12-27","2001-12-30","");
|
---|
| 43 | $break1->SetBreakStyle(true,'dotted',2);
|
---|
| 44 | $break1->SetColor('red');
|
---|
| 45 | $graph->Add($break1);
|
---|
| 46 |
|
---|
| 47 | // Format the bar for the second activity
|
---|
| 48 | // ($row,$title,$startdate,$enddate)
|
---|
| 49 | $activity2 = new GanttBar(0,"","2001-12-31","2002-01-2","[BO]");
|
---|
| 50 |
|
---|
| 51 | // ADjust font for caption
|
---|
| 52 | $activity2->caption->SetFont(FF_ARIAL,FS_BOLD);
|
---|
| 53 | $activity2->caption->SetColor("darkred");
|
---|
| 54 |
|
---|
| 55 | // Yellow diagonal line pattern on a red background
|
---|
| 56 | $activity2->SetPattern(BAND_RDIAG,"yellow");
|
---|
| 57 | $activity2->SetFillColor("red");
|
---|
| 58 |
|
---|
| 59 | // Finally add the bar to the graph
|
---|
| 60 | $graph->Add($activity1);
|
---|
| 61 | $graph->Add($activity2);
|
---|
| 62 |
|
---|
| 63 | // ... and display it
|
---|
| 64 | $graph->Stroke();
|
---|
| 65 | ?>
|
---|