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("(ganttex16.php)");
|
---|
13 |
|
---|
14 | // Show day, week and month scale
|
---|
15 | $graph->ShowHeaders(GANTT_HDAY | GANTT_HWEEK | GANTT_HMONTH);
|
---|
16 |
|
---|
17 | // Set table title
|
---|
18 | $graph->scale->tableTitle->Set("(Rev: 1.22)");
|
---|
19 | $graph->scale->tableTitle->SetFont(FF_FONT1,FS_BOLD);
|
---|
20 | $graph->scale->SetTableTitleBackground("silver");
|
---|
21 | $graph->scale->tableTitle->Show();
|
---|
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_SHORTNAMEYEAR2);
|
---|
26 | $graph->scale->month->SetFontColor("white");
|
---|
27 | $graph->scale->month->SetBackgroundColor("blue");
|
---|
28 |
|
---|
29 | // 0 % vertical label margin
|
---|
30 | $graph->SetLabelVMarginFactor(1);
|
---|
31 |
|
---|
32 | // Format the bar for the first activity
|
---|
33 | // ($row,$title,$startdate,$enddate)
|
---|
34 | $activity = new GanttBar(0,"Project","2001-12-21","2002-01-07","[50%]");
|
---|
35 |
|
---|
36 | // Yellow diagonal line pattern on a red background
|
---|
37 | $activity->SetPattern(BAND_RDIAG,"yellow");
|
---|
38 | $activity->SetFillColor("red");
|
---|
39 |
|
---|
40 | // Set absolute height
|
---|
41 | $activity->SetHeight(10);
|
---|
42 |
|
---|
43 | // Specify progress to 60%
|
---|
44 | $activity->progress->Set(0.6);
|
---|
45 | $activity->progress->SetPattern(BAND_HVCROSS,"blue");
|
---|
46 |
|
---|
47 | // Format the bar for the second activity
|
---|
48 | // ($row,$title,$startdate,$enddate)
|
---|
49 | $activity2 = new GanttBar(1,"Project","2001-12-21","2002-01-02","[30%]");
|
---|
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
|
---|
56 | $activity2->SetHeight(10);
|
---|
57 |
|
---|
58 | // Specify progress to 30%
|
---|
59 | $activity2->progress->Set(0.3);
|
---|
60 | $activity2->progress->SetPattern(BAND_HVCROSS,"blue");
|
---|
61 |
|
---|
62 | // Finally add the bar to the graph
|
---|
63 | $graph->Add($activity);
|
---|
64 | $graph->Add($activity2);
|
---|
65 |
|
---|
66 | // Add a vertical line
|
---|
67 | $vline = new GanttVLine("2001-12-24","Phase 1");
|
---|
68 | $vline->SetDayOffset(0.5);
|
---|
69 | //$graph->Add($vline);
|
---|
70 |
|
---|
71 | // ... and display it
|
---|
72 | $graph->Stroke();
|
---|
73 | ?>
|
---|