Contents Previous Next

10.7.3 Milestones

Milestones are similar to bars but have no end date since milestones just apply to one single date. Milestones are created much the same way as activities but using method MileStone() instead.

The full signature for milestones are

  function MileStone ($aVPos,$aTitle, $aDate, $aCaption)

 $aVPos   The vertical position for the bar, [0..n]
 $aTitle   Title for the activity
 $aDate   Date for the milestone
 $aCaption   Text to the right of the milestone

Valid milestones are for example

By default milestones are rendered as a filled "Diamond" shape. This may be optionally modified. The actual shape is specified by the 'mark' property of milestone which is an instance of the PlotMark() class (same class responsible for the marks in line graphs).

To change the shape of a milestone to, say a triangle, you use the SetType() method as in

 $milestone->mark-> SetType( MARK_DTRIANGLE)

Let's put this into practice and add a milestone to our previous example by adding the following two lines of code which result in Figure 147 shown below.

Figure 147: Illustration of how to add a milestone to a gantt chart [src] 

You may note that by default the title color is red for milestones. If you like to change this to be instead, say bold black, you would invoke the SetColor() and SetFont() methods on the title property of milestones as in

 $milestone-> title->SetFont(FF_FONT1 ,FF_BOLD);
$milestone ->title->SetColor( "black");

and thew result would now (not surprisingly be)

Figure 148: Modifying the milestone title color and font [src] 

To modify the caption you do exactly the same but act on property 'caption' instead of 'title', i.e.

 $milestone->caption-> SetFont( FF_FONT1, FF_BOLD);
$milestone ->caption->SetColor( "black");

It is worth noting that you modify the bar title and caption the exact same way by acting on the 'title' and 'caption' property for the bars.

Contents Previous Next