The code I have used to do this is (snippet):
Code: Select all
<?php
$drawing=NewDrawingWand();
DrawSetStrokeWidth($drawing,0);
DrawSetStrokeLineCap($drawing, MW_RoundCap);
DrawSetStrokeLineJoin($drawing, MW_RoundJoin);
DrawSetFillOpacity($drawing,1);
DrawSetFont($drawing,"verdana.ttf");
DrawSetFontSize($drawing,8);
DrawSetStrokeAlpha($drawing,1);
$pixel = NewPixelWand();
// highlight today
PixelSetColor($pixel, 'grey');
DrawSetFillColor($drawing, $pixel);
DrawRectangle($drawing, $this->diagramWidth / 2, 0, (($this->diagramWidth / $this->daysToShow) * ($this->daysToShow / 2 + 1)), $this->diagramHeight - 40);
PixelSetColor($pixel, 'black');
DrawSetFillColor($drawing, $pixel);
for ($i = 1; $i < $this->daysToShow; $i++) {
$thisDate = getDate($diagramDate);
$xCoord = ($this->diagramWidth / $this->daysToShow) * $i;
// draw day mark and day number
DrawLine($drawing, $xCoord, $this->diagramHeight - 40, $xCoord, 0);
DrawAnnotation($drawing, $xCoord - 5, $this->diagramHeight - 29, $thisDate["mday"]);
$diagramDate += $nrSecondsPerDay;
}
// draw middle cross - y axis
DrawLine($drawing, 0, ($this->diagramHeight - 40) / 2, $this->diagramWidth, ($this->diagramHeight - 40) / 2);
?>
Also, if anyone can tell me why some of the lines are darker than the others or if I have done anything wrong here please that would be appreciated.
Thanks