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