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->SetBox(); |
---|
7 | $graph->SetShadow(); |
---|
8 | |
---|
9 | // Add title and subtitle |
---|
10 | $graph->title->Set("Example of captions"); |
---|
11 | $graph->title->SetFont(FF_ARIAL,FS_BOLD,12); |
---|
12 | $graph->subtitle->Set("(ganttex15.php)"); |
---|
13 | |
---|
14 | // Show day, week and month scale |
---|
15 | $graph->ShowHeaders(GANTT_HDAY | GANTT_HWEEK | GANTT_HMONTH); |
---|
16 | |
---|
17 | |
---|
18 | // Use the short name of the month together with a 2 digit year |
---|
19 | // on the month scale |
---|
20 | $graph->scale->month->SetStyle(MONTHSTYLE_SHORTNAMEYEAR2); |
---|
21 | $graph->scale->month->SetFontColor("white"); |
---|
22 | $graph->scale->month->SetBackgroundColor("blue"); |
---|
23 | |
---|
24 | // 0 % vertical label margin |
---|
25 | $graph->SetLabelVMarginFactor(1); |
---|
26 | |
---|
27 | // Format the bar for the first activity |
---|
28 | // ($row,$title,$startdate,$enddate) |
---|
29 | $activity = new GanttBar(0,"Project","2001-12-21","2002-01-07","[50%]"); |
---|
30 | |
---|
31 | // Yellow diagonal line pattern on a red background |
---|
32 | $activity->SetPattern(BAND_RDIAG,"yellow"); |
---|
33 | $activity->SetFillColor("red"); |
---|
34 | |
---|
35 | // Set absolute height |
---|
36 | $activity->SetHeight(10); |
---|
37 | |
---|
38 | // Specify progress to 60% |
---|
39 | $activity->progress->Set(0.6); |
---|
40 | $activity->progress->SetPattern(BAND_HVCROSS,"blue"); |
---|
41 | |
---|
42 | // Format the bar for the second activity |
---|
43 | // ($row,$title,$startdate,$enddate) |
---|
44 | $activity2 = new GanttBar(1,"Project","2001-12-21","2002-01-02","[30%]"); |
---|
45 | |
---|
46 | // Yellow diagonal line pattern on a red background |
---|
47 | $activity2->SetPattern(BAND_RDIAG,"yellow"); |
---|
48 | $activity2->SetFillColor("red"); |
---|
49 | |
---|
50 | // Set absolute height |
---|
51 | $activity2->SetHeight(10); |
---|
52 | |
---|
53 | // Specify progress to 30% |
---|
54 | $activity2->progress->Set(0.3); |
---|
55 | $activity2->progress->SetPattern(BAND_HVCROSS,"blue"); |
---|
56 | |
---|
57 | // Finally add the bar to the graph |
---|
58 | $graph->Add($activity); |
---|
59 | $graph->Add($activity2); |
---|
60 | |
---|
61 | // Add a vertical line |
---|
62 | $vline = new GanttVLine("2001-12-24","Phase 1"); |
---|
63 | $vline->SetDayOffset(0.5); |
---|
64 | //$graph->Add($vline); |
---|
65 | |
---|
66 | // ... and display it |
---|
67 | $graph->Stroke(); |
---|
68 | ?> |
---|