source: trunk/xgraph/jpgraph/Examples/ganttex17.php

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