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

Last change on this file since 42 was 42, checked in by marrucho, 10 years ago
File size: 1.9 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->SetShadow();
7
8// Add title and subtitle
9$graph->title->Set("Activities on same row");
10$graph->title->SetFont(FF_ARIAL,FS_BOLD,12);
11
12// Show day, week and month scale
13$graph->ShowHeaders(GANTT_HDAY | GANTT_HWEEK | GANTT_HMONTH);
14
15// Instead of week number show the date for the first day in the week
16// on the week scale
17$graph->scale->week->SetStyle(WEEKSTYLE_FIRSTDAY);
18
19// Make the week scale font smaller than the default
20$graph->scale->week->SetFont(FF_FONT0);
21
22// Use the short name of the month together with a 2 digit year
23// on the month scale
24$graph->scale->month->SetStyle(MONTHSTYLE_SHORTNAMEYEAR4);
25$graph->scale->month->SetFontColor("white");
26$graph->scale->month->SetBackgroundColor("blue");
27
28// 0 % vertical label margin
29$graph->SetLabelVMarginFactor(1); // 1=default value
30
31// Format the bar for the first activity
32// ($row,$title,$startdate,$enddate)
33$activity1 = new GanttBar(0,"Activity 1","2001-12-21","2001-12-26","");
34
35// Yellow diagonal line pattern on a red background
36$activity1->SetPattern(BAND_RDIAG,"yellow");
37$activity1->SetFillColor("red");
38
39// Set absolute height of activity
40$activity1->SetHeight(16);
41
42// Format the bar for the second activity
43// ($row,$title,$startdate,$enddate)
44$activity2 = new GanttBar(0,"","2001-12-31","2002-01-2","[BO]");
45
46// ADjust font for caption
47$activity2->caption->SetFont(FF_ARIAL,FS_BOLD);
48$activity2->caption->SetColor("darkred");
49
50// Yellow diagonal line pattern on a red background
51$activity2->SetPattern(BAND_RDIAG,"yellow");
52$activity2->SetFillColor("red");
53
54// Set absolute height of activity
55$activity2->SetHeight(16);
56
57// Finally add the bar to the graph
58$graph->Add($activity1);
59$graph->Add($activity2);
60
61// ... and display it
62$graph->Stroke();
63?>
Note: See TracBrowser for help on using the repository browser.