Subversion-Projekte lars-tiefland.php_share

Revision

Details | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
1 lars 1
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
2
<HTML>
3
<HEAD>
4
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=iso-iso-8859-1">
5
<LINK REL="Start" HREF="index.html">
6
<LINK REL="Contents" HREF="toc.html">
7
<LINK REL="Prev" HREF="10126Adjustingthemarginswithautosizing.html">
8
<LINK REL="Next" HREF="1014AddingCSIMClientsideImageMapstoGanttcharts.html">
9
<STYLE TYPE="text/css"><!--
10
BODY { font-family: serif }
11
H1 { font-family: sans-serif }
12
H2 { font-family: sans-serif }
13
H3 { font-family: sans-serif }
14
H4 { font-family: sans-serif }
15
H5 { font-family: sans-serif }
16
H6 { font-family: sans-serif }
17
SUB { font-size: smaller }
18
SUP { font-size: smaller }
19
PRE { font-family: monospace }
20
A { text-decoration: none }
21
--></STYLE>
22
</HEAD>
23
<BODY>
24
<A HREF="toc.html">Contents</A>
25
<A HREF="10126Adjustingthemarginswithautosizing.html">Previous</A>
26
<A HREF="1014AddingCSIMClientsideImageMapstoGanttcharts.html">Next</A>
27
<HR NOSHADE>
28
<H2><A NAME="10_13">10.13 Simplifying the drawing of Gantt graphs</A></H2>
29
<P> As we have shown in the previous examples constructing a Gantt chart
30
 consists of a number of repetitive tasks; Create the individual
31
 activity bars and add them to the graph.</P>
32
<P> Now when you have a basic understanding of how this works you are
33
 ready to appreciate a small helper method. <A href="">
34
GanttGraph::CreateSimple()</A>. This method takes a few arrays of data
35
 which specifies you Gantt chart and then constructs this chart. By
36
 using this method you sacrifices a few adjustment possibilities for
37
 simplicity. This method is nothing magical it just takes the data for
38
 the activities,(start and end date, titles, progress, any constrains
39
 and so on) and constructs the activities and adds them to the graph.</P>
40
<P> The activities are specified in data array which for each activity
41
 have the following fields</P>
42
<UL>
43
<LI> What row the activity should be on</LI>
44
<LI> Activity type, controls the appearance. Can be one of
45
<OL>
46
<LI> ACTYPE_NORMAL, A standard activty bar</LI>
47
<LI> ACTYPE_GROUP, A Grouping bar</LI>
48
<LI> ACTYPE_MILESTONE, A milestone</LI>
49
<LI></LI>
50
</OL>
51
<P></P>
52
</LI>
53
<LI> Title text</LI>
54
<LI> Start date</LI>
55
<LI> End date (NOT FOR Milestones!)</LI>
56
<LI> Caption</LI>
57
</UL>
58
<P></P>
59
<P> So for example to create a Gantt chart consisting of two activities
60
 which are grouped and a milestone one would have to use something
61
 similar to the following code</P>
62
<P><DIV class="phpscript"><CODE><FONT color="#000000"> <FONT color="#0000BB">
63
&nbsp;$data&nbsp;</FONT><FONT color="#007700">=&nbsp;array(
64
<BR>&nbsp;&nbsp;array(</FONT><FONT color="#0000BB">0</FONT><FONT color="#007700">,</FONT><FONT
65
color="#0000BB">ACTYPE_GROUP</FONT><FONT color="#007700">,&nbsp;&nbsp;&nbsp;&nbsp;</FONT><FONT
66
color="#DD0000">&quot;Phase&nbsp;1&quot;</FONT><FONT color="#007700">,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</FONT><FONT
67
color="#DD0000">&quot;2001-10-26&quot;</FONT><FONT color="#007700">,</FONT><FONT color="#DD0000">
68
&quot;2001-11-23&quot;</FONT><FONT color="#007700">,</FONT><FONT color="#DD0000">
69
&quot;&quot;</FONT><FONT color="#007700">),
70
<BR>&nbsp;&nbsp;array(</FONT><FONT color="#0000BB">1</FONT><FONT color="#007700">,</FONT><FONT
71
color="#0000BB">ACTYPE_NORMAL</FONT><FONT color="#007700">,&nbsp;&nbsp;&nbsp;</FONT><FONT
72
color="#DD0000">&quot;&nbsp;&nbsp;Label&nbsp;2&quot;</FONT><FONT color="#007700">,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</FONT><FONT
73
color="#DD0000">&quot;2001-10-26&quot;</FONT><FONT color="#007700">,</FONT><FONT color="#DD0000">
74
&quot;2001-11-13&quot;</FONT><FONT color="#007700">,</FONT><FONT color="#DD0000">
75
&quot;[KJ]&quot;</FONT><FONT color="#007700">),
76
<BR>&nbsp;&nbsp;array(</FONT><FONT color="#0000BB">2</FONT><FONT color="#007700">,</FONT><FONT
77
color="#0000BB">ACTYPE_NORMAL</FONT><FONT color="#007700">,&nbsp;&nbsp;&nbsp;</FONT><FONT
78
color="#DD0000">&quot;&nbsp;&nbsp;Label&nbsp;3&quot;</FONT><FONT color="#007700">,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</FONT><FONT
79
color="#DD0000">&quot;2001-11-20&quot;</FONT><FONT color="#007700">,</FONT><FONT color="#DD0000">
80
&quot;2001-11-22&quot;</FONT><FONT color="#007700">,</FONT><FONT color="#DD0000">
81
&quot;[EP]&quot;</FONT><FONT color="#007700">),
82
<BR>&nbsp;&nbsp;array(</FONT><FONT color="#0000BB">3</FONT><FONT color="#007700">,</FONT><FONT
83
color="#0000BB">ACTYPE_MILESTONE</FONT><FONT color="#007700">,</FONT><FONT
84
color="#DD0000">&quot;&nbsp;&nbsp;Phase&nbsp;1&nbsp;Done&quot;</FONT><FONT color="#007700">,&nbsp;</FONT><FONT
85
color="#DD0000">&quot;2001-11-23&quot;</FONT><FONT color="#007700">,</FONT><FONT color="#DD0000">
86
&quot;M2&quot;</FONT><FONT color="#007700">)&nbsp;);
87
<BR>
88
<BR></FONT><FONT color="#FF8000">//&nbsp;Create&nbsp;the&nbsp;basic&nbsp;graph
89
<BR></FONT><FONT color="#0000BB">$graph&nbsp;</FONT><FONT color="#007700">
90
=&nbsp;new&nbsp;</FONT><FONT color="#0000BB">GanttGraph</FONT><FONT color="#007700">
91
();
92
<BR></FONT><FONT color="#0000BB">$graph</FONT><FONT color="#007700">-&gt;</FONT><FONT
93
color="#0000BB">title</FONT><FONT color="#007700">-&gt;</FONT><FONT color="#0000BB">
94
Set</FONT><FONT color="#007700">(</FONT><FONT color="#DD0000">
95
&quot;Gantt&nbsp;Graph&nbsp;using&nbsp;CreateSimple()&quot;</FONT><FONT color="#007700">);
96
<BR>
97
<BR></FONT><FONT color="#FF8000">//&nbsp;Setup&nbsp;scale
98
<BR></FONT><FONT color="#0000BB">$graph</FONT><FONT color="#007700">-&gt;</FONT><FONT
99
color="#0000BB">ShowHeaders</FONT><FONT color="#007700">(</FONT><FONT color="#0000BB">
100
GANTT_HYEAR&nbsp;</FONT><FONT color="#007700">|&nbsp;</FONT><FONT color="#0000BB">
101
GANTT_HMONTH&nbsp;</FONT><FONT color="#007700">|&nbsp;</FONT><FONT color="#0000BB">
102
GANTT_HDAY&nbsp;</FONT><FONT color="#007700">|&nbsp;</FONT><FONT color="#0000BB">
103
GANTT_HWEEK</FONT><FONT color="#007700">);
104
<BR></FONT><FONT color="#0000BB">$graph</FONT><FONT color="#007700">-&gt;</FONT><FONT
105
color="#0000BB">scale</FONT><FONT color="#007700">-&gt;</FONT><FONT color="#0000BB">
106
week</FONT><FONT color="#007700">-&gt;</FONT><FONT color="#0000BB">SetStyle</FONT><FONT
107
color="#007700">(</FONT><FONT color="#0000BB">WEEKSTYLE_FIRSTDAY</FONT><FONT
108
color="#007700">);
109
<BR>
110
<BR></FONT><FONT color="#FF8000">//&nbsp;Add&nbsp;the&nbsp;specified&nbsp;activities
111
<BR></FONT><FONT color="#0000BB">$graph</FONT><FONT color="#007700">-&gt;</FONT><FONT
112
color="#0000BB">CreateSimple</FONT><FONT color="#007700">(</FONT><FONT color="#0000BB">
113
$data</FONT><FONT color="#007700">);
114
<BR>
115
<BR></FONT><FONT color="#FF8000">//&nbsp;..&nbsp;and&nbsp;stroke&nbsp;the&nbsp;graph
116
<BR></FONT><FONT color="#0000BB">$graph</FONT><FONT color="#007700">-&gt;</FONT><FONT
117
color="#0000BB">Stroke</FONT><FONT color="#007700">();
118
<BR></FONT><FONT color="#0000BB"></FONT></FONT></CODE></DIV></P>
119
<P> This will then show up as<DIV class="example">
120
<BR> <A href="exframes/frame_ganttsimpleex1.html" target="blank"><IMG border="0"
121
HEIGHT="231"  src="img/ganttsimpleex1.png" WIDTH="523"></A>
122
<BR><B>Figure 166:</B> Using the simplified way via CreateSimple()
123
 method <A href="exframes/frame_ganttsimpleex1.html" target="blank">
124
[src]</A>&nbsp;
125
<P></P>
126
</DIV></P>
127
<P> You may (slightly) modify the appearance of the simple Gantt charts
128
 by means of the methods <A href="">GanttGraph::SetSimpleFont()</A> and <A
129
href="">GanttGraph::SetSimpleStyle()</A> But not anything else, remember
130
 that the purpose with this way of constructing graphs is to be simple.
131
 If you need full advanced control you have to construct all the
132
 activities in the &quot;normal&quot; way.</P>
133
<P> You can also specify constrains and progress for each bar by
134
 supplying additional data arrays to GanttGraph::CreateSimple().</P>
135
<HR NOSHADE>
136
<A HREF="toc.html">Contents</A>
137
<A HREF="10126Adjustingthemarginswithautosizing.html">Previous</A>
138
<A HREF="1014AddingCSIMClientsideImageMapstoGanttcharts.html">Next</A>
139
</BODY>
140
</HTML>