~pablocapeluto/cds-php/devel-3.1

« back to all changes in this revision

Viewing changes to jpgraph/src/Examples/ganttex14.php

  • Committer: pcapeluto at gmail
  • Date: 2010-08-20 17:51:08 UTC
  • Revision ID: pcapeluto@gmail.com-20100820175108-jyi8dbyj15uy9p4i
Initial import

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<?php
 
2
include ("../jpgraph.php");
 
3
include ("../jpgraph_gantt.php");
 
4
 
 
5
$graph = new GanttGraph(0,0,"auto");
 
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
?>