Blame | Letzte Änderung | Log anzeigen | RSS feed
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd"><HTML><HEAD><META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=iso-iso-8859-1"><LINK REL="Start" HREF="index.html"><LINK REL="Contents" HREF="toc.html"><LINK REL="Prev" HREF="973Milestones.html"><LINK REL="Next" HREF="975Addingmarkerstoaganttbar.html"><STYLE TYPE="text/css"><!--BODY { font-family: serif }H1 { font-family: sans-serif }H2 { font-family: sans-serif }H3 { font-family: sans-serif }H4 { font-family: sans-serif }H5 { font-family: sans-serif }H6 { font-family: sans-serif }SUB { font-size: smaller }SUP { font-size: smaller }PRE { font-family: monospace }A { text-decoration: none }--></STYLE></HEAD><BODY><A HREF="toc.html">Contents</A><A HREF="973Milestones.html">Previous</A><A HREF="975Addingmarkerstoaganttbar.html">Next</A><HR NOSHADE><H3><A NAME="9_7_4">9.7.4 Vertical line</A></H3><P> The final object you may add to a Gantt chart is simple, but quiteuseful, a straight vertical line extending over the whole plot height.This could for example be used to illustrate different phases in aproject. You create a line object by a call to GanttVLine()</P><P> The full signature for GanttVLine() is<DIV class="phpscript"><CODE><FONTcolor="#000000"> <FONT color="#0000BB"> </FONT><FONT color="#007700">function </FONT><FONT color="#0000BB">GanttVLine</FONT><FONT color="#007700">(</FONT><FONT color="#0000BB">$aDate</FONT><FONT color="#007700">,</FONT><FONTcolor="#0000BB">$aTitle</FONT><FONT color="#007700">,</FONT><FONT color="#0000BB">$aColor</FONT><FONT color="#007700">,</FONT><FONT color="#0000BB">$aWeight</FONT><FONT color="#007700">,</FONT><FONT color="#0000BB">$aStyle</FONT><FONT color="#007700">)</FONT><FONT color="#0000BB"></FONT></FONT></CODE></DIV></P><P></P><P></P><TABLE border="0"><TR><TD valign="top"><!--span style="font-family:times;font-size:85%;font-weight:bold;"--><CODE><FONT color="#000000"> <FONT color="#0000BB"> $aDate </FONT></FONT></CODE></TD><TD valign="top"> </TD><TD>Date for the milestone</TD></TR><TR><TD valign="top"><!--span style="font-family:times;font-size:85%;font-weight:bold;"--><CODE><FONT color="#000000"> <FONT color="#0000BB"> $aTitle </FONT></FONT></CODE></TD><TD valign="top"> </TD><TD>Title for the line. The title isdisplayed at the bottom of the line</TD></TR><TR><TD valign="top"><!--span style="font-family:times;font-size:85%;font-weight:bold;"--><CODE><FONT color="#000000"> <FONT color="#0000BB"> $aColor </FONT></FONT></CODE></TD><TD valign="top"> </TD><TD>Color for the line</TD></TR><TR><TD valign="top"><!--span style="font-family:times;font-size:85%;font-weight:bold;"--><CODE><FONT color="#000000"> <FONT color="#0000BB"> $aWeight </FONT></FONT></CODE></TD><TD valign="top"> </TD><TD>Line width</TD></TR><TR><TD valign="top"><!--span style="font-family:times;font-size:85%;font-weight:bold;"--><CODE><FONT color="#000000"> <FONT color="#0000BB"> $aStyle </FONT></FONT></CODE></TD><TD valign="top"> </TD><TD>Line style,"dashed", "dotted" andso on</TD></TR></TABLE><P> Valid creations of lines are for example</P><UL><LI><DIV class="phpscript"><CODE><FONT color="#000000"> <FONT color="#0000BB"> $vline </FONT><FONT color="#007700">= new </FONT><FONT color="#0000BB">GanttVLine</FONT><FONT color="#007700">(</FONT><FONT color="#DD0000">"2001-12-24"</FONT><FONT color="#007700">);</FONT><FONT color="#0000BB"></FONT></FONT></CODE></DIV><P></P></LI><LI><DIV class="phpscript"><CODE><FONT color="#000000"> <FONT color="#0000BB"> $vline </FONT><FONT color="#007700">= new </FONT><FONT color="#0000BB">GanttVLine</FONT><FONT color="#007700">(</FONT><FONT color="#DD0000">"2001-12-24"</FONT><FONT color="#007700">,</FONT><FONT color="#DD0000">"Phase 1"</FONT><FONT color="#007700">);</FONT><FONT color="#0000BB"></FONT></FONT></CODE></DIV><P></P></LI><LI><DIV class="phpscript"><CODE><FONT color="#000000"> <FONT color="#0000BB"> $vline </FONT><FONT color="#007700">= new </FONT><FONT color="#0000BB">GanttVLine</FONT><FONT color="#007700">(</FONT><FONT color="#DD0000">"2001-12-24"</FONT><FONT color="#007700">,</FONT><FONT color="#DD0000">"Phase 1"</FONT><FONT color="#007700">,</FONT><FONT color="#DD0000">"darkred"</FONT><FONT color="#007700">);</FONT><FONT color="#0000BB"></FONT></FONT></CODE></DIV><P></P></LI><LI><DIV class="phpscript"><CODE><FONT color="#000000"> <FONT color="#0000BB"> $vline </FONT><FONT color="#007700">= new </FONT><FONT color="#0000BB">GanttVLine</FONT><FONT color="#007700">(</FONT><FONT color="#DD0000">"2001-12-24"</FONT><FONT color="#007700">,</FONT><FONT color="#DD0000">"Phase 1"</FONT><FONT color="#007700">,</FONT><FONT color="#DD0000">"darkred"</FONT><FONT color="#007700">,</FONT><FONT color="#0000BB">5</FONT><FONTcolor="#007700">);</FONT><FONT color="#0000BB"></FONT></FONT></CODE></DIV><P></P></LI><LI><DIV class="phpscript"><CODE><FONT color="#000000"> <FONT color="#0000BB"> $vline </FONT><FONT color="#007700">= new </FONT><FONT color="#0000BB">GanttVLine</FONT><FONT color="#007700">(</FONT><FONT color="#DD0000">"2001-12-24"</FONT><FONT color="#007700">,</FONT><FONT color="#DD0000">"Phase 1"</FONT><FONT color="#007700">,</FONT><FONT color="#DD0000">"darkred"</FONT><FONT color="#007700">,</FONT><FONT color="#0000BB">5</FONT><FONTcolor="#007700">,</FONT><FONT color="#DD0000">"dotted"</FONT><FONT color="#007700">);</FONT><FONT color="#0000BB"></FONT></FONT></CODE></DIV><P></P></LI></UL><P> To add the line to the graph you just have to call GanttGraph::Add()as with milestones and bars. Let's illustrate the use of vertical linesby adding a line to the previous example.<DIV class="phpscript"><CODE><FONTcolor="#000000"> <FONT color="#0000BB"> $vline </FONT><FONT color="#007700">= new </FONT><FONT color="#0000BB">GanttVLine</FONT><FONT color="#007700">(</FONT><FONT color="#DD0000">"2001-12-24"</FONT><FONT color="#007700">,</FONT><FONTcolor="#DD0000">"Phase 1"</FONT><FONT color="#007700">);<BR></FONT><FONT color="#0000BB">$graph</FONT><FONT color="#007700">-></FONT><FONTcolor="#0000BB">Add</FONT><FONT color="#007700">(</FONT><FONT color="#0000BB">$vline</FONT><FONT color="#007700">);<BR></FONT><FONT color="#0000BB"></FONT></FONT></CODE></DIV></P><P> and the example (See 153) now becomes<DIV class="example"><BR> <A href="exframes/frame_ganttex06.html" target="blank"><IMG border="0"HEIGHT="189" src="img/img/img/img/img/img/ganttex06.png" WIDTH="502"></A><BR><B>Figure 153:</B> Adding a vertical line with a title to the Ganttchart <A href="exframes/frame_ganttex06.html" target="blank">[src]</A> <P></P></DIV></P><P> From the above figure you can see that by default the line is drawnat the beginning of the day of the specified date and in a 'dashed'style. This can (of course!) be modified so that the line isdrawn/aligned anywhere in the specified day. You modify this byinvoking the method SetDayOffset() with an argument specifying thefraction of the day where you want the line positioned.</P><P> If you, for example, want to display the line in the middle of theday just add the line<DIV class="phpscript"><CODE><FONT color="#000000"><FONT color="#0000BB"> $vline</FONT><FONT color="#007700">-></FONT><FONTcolor="#0000BB">SetDayOffset</FONT><FONT color="#007700">(</FONT><FONT color="#0000BB">0.5</FONT><FONT color="#007700">);</FONT><FONT color="#0000BB"></FONT></FONT></CODE></DIV></P><P> to the previous code and the result will be<DIV class="example"><BR> <A href="exframes/frame_ganttex07.html" target="blank"><IMG border="0"HEIGHT="189" src="img/img/img/img/img/img/ganttex07.png" WIDTH="502"></A><BR><B>Figure 154:</B> Modifying the position of the line within the day<A href="exframes/frame_ganttex07.html" target="blank">[src]</A> <P></P></DIV></P><P></P><P> As usual you may modify the font, size and color by invoking theappropriate method (SetFont(), SetColor()) on the 'title' property oflines.</P><HR NOSHADE><A HREF="toc.html">Contents</A><A HREF="973Milestones.html">Previous</A><A HREF="975Addingmarkerstoaganttbar.html">Next</A></BODY></HTML>