source: trunk/xgraph/jpgraph/Examples/ganttex18.php @ 42

Last change on this file since 42 was 42, checked in by marrucho, 10 years ago
File size: 2.3 KB
Line 
1<?php // content="text/plain; charset=utf-8"
2require_once ('jpgraph/jpgraph.php');
3require_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("(ganttex18.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
22// Modify the appearance of the dividing lines
23$graph->scale->divider->SetWeight(3);
24$graph->scale->divider->SetColor("navy");
25
26$graph->scale->dividerh->SetWeight(3);
27$graph->scale->dividerh->SetColor("navy");
28
29$graph->SetBox(true,"navy",3);
30
31
32// Use the short name of the month together with a 2 digit year
33// on the month scale
34$graph->scale->month->SetStyle(MONTHSTYLE_SHORTNAMEYEAR2);
35$graph->scale->month->SetFontColor("white");
36$graph->scale->month->SetBackgroundColor("blue");
37
38// 0 % vertical label margin
39$graph->SetLabelVMarginFactor(1);
40
41// Format the bar for the first activity
42// ($row,$title,$startdate,$enddate)
43$activity = new GanttBar(0,"Project","2001-12-21","2002-01-07","[50%]");
44
45// Yellow diagonal line pattern on a red background
46$activity->SetPattern(BAND_RDIAG,"yellow");
47$activity->SetFillColor("red");
48
49// Set absolute height
50$activity->SetHeight(10);
51
52// Specify progress to 60%
53$activity->progress->Set(0.6);
54$activity->progress->SetPattern(BAND_HVCROSS,"blue");
55
56// Format the bar for the second activity
57// ($row,$title,$startdate,$enddate)
58$activity2 = new GanttBar(1,"Project","2001-12-21","2002-01-02","[30%]");
59
60// Yellow diagonal line pattern on a red background
61$activity2->SetPattern(BAND_RDIAG,"yellow");
62$activity2->SetFillColor("red");
63
64// Set absolute height
65$activity2->SetHeight(10);
66
67// Specify progress to 30%
68$activity2->progress->Set(0.3);
69$activity2->progress->SetPattern(BAND_HVCROSS,"blue");
70
71// Finally add the bar to the graph
72$graph->Add($activity);
73$graph->Add($activity2);
74
75// Add a vertical line
76$vline = new GanttVLine("2001-12-24","Phase 1");
77$vline->SetDayOffset(0.5);
78//$graph->Add($vline);
79
80// ... and display it
81$graph->Stroke();
82?>
Note: See TracBrowser for help on using the repository browser.