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

Last change on this file since 42 was 42, checked in by marrucho, 10 years ago
File size: 1.8 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("(ganttex14.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
41// Format the bar for the second activity
42// ($row,$title,$startdate,$enddate)
43$activity2 = new GanttBar(1,"Project","2001-12-21","2002-01-02","[30%]");
44
45// Yellow diagonal line pattern on a red background
46$activity2->SetPattern(BAND_RDIAG,"yellow");
47$activity2->SetFillColor("red");
48
49// Set absolute height
50$activity2->SetHeight(10);
51
52// Specify progress to 30%
53$activity2->progress->Set(0.3);
54
55
56// Finally add the bar to the graph
57$graph->Add($activity);
58$graph->Add($activity2);
59
60// Add a vertical line
61$vline = new GanttVLine("2001-12-24","Phase 1");
62$vline->SetDayOffset(0.5);
63//$graph->Add($vline);
64
65// ... and display it
66$graph->Stroke();
67?>
Note: See TracBrowser for help on using the repository browser.