You can easily add a variety of markers both to the start and end of the gantt bar. They could for example be used as an alternate way to illustrate important milestones or anticipated deliveries.
The left and right markers are accessed through the two properties 'leftMark' and 'rightMark'. They are both instances of the general 'PlotMark' class which is also used for the milestones (and in line graphs). The 'PlotMark' class supports several different styles, for example, diamond (the default for milestones), filled and unfilled circles, squares, stares, and so on. Please refer to the reference section for a complete listing.
Let's illustrate this by adding a right marker to the previous example. We will use a style of a filled (red) circle with a white title, say, "M5". In order to accomplish this we must augment the previous example with the following lines:
$activity
->rightMark->Show();
$activity
->rightMark->title->
Set("M5");
$activity
->rightMark->SetType(
MARK_FILLEDCIRCLE);
$activity
->rightMark->SetWidth(
10);
$activity
->rightMark->SetColor(
"red");
$activity
->rightMark->SetFillColor(
"red");
$activity
->rightMark->title->
SetFont(
FF_ARIAL,
FS_BOLD,12);
$activity
->rightMark->title->
SetColor(
"white");
This might seem like a lot of lines but this is as complicated as it possible can get. As an illustration in the example belwo more or less everything that is changeable has been changed, the default font, font-color, fill-color, frame-color and width of marker. The two lines only really necessary are the first two, showing the mark and setting a title. One could still get a good result by using default values for the rest of the properties.
The resulting image can be seen in Figure 155 below.
We have deliberately introduced a "strangeness" here. If the previous two examples are compared it can bee seen that the last example is larger than the previous one. Why?
The explanation is trivial once we recall that the height of bars are sized relative to the horizontal spacing. The horizontal spacing are based on the highest single bar including title size and, here come the explanation, marker size. The horizontal spacing has grown since the minimum height is now based on 10 points(=the height of the mark). The bar still occupy the same percentage of the height so it seems to have grown.
If this behavior is unwanted it is always possible to specify an absolute size for the bar heigh, say 8 pixels, with a call
$activity->SetHeight
(8);
and achieve the result in Figure 156 below.
It is worth noting that the height reserved for each bar is still the same since we haven't changed the height of the marker and the reserved space is the maximum height used by any bar.