for ($i = 0; $i < $weeks; $i++) { $period_start = $start + 7 * 24 * 3600 * $i; $period_end = $start + 7 * 24 * 3600 * ($i + 1); $stat = calculate_availability($_REQUEST['triggerid'], $period_start, $period_end); $true[$i] = $stat['true']; $false[$i] = $stat['false']; $unknown[$i] = $stat['unknown']; $count_now[$i] = 1; //SDI($false[$i]); } for ($i = 0; $i <= $sizeY; $i += $sizeY / 10) { DashedLine($im, $shiftX, $i + $shiftYup, $sizeX + $shiftX, $i + $shiftYup, $gray); } $j = 0; for ($i = 0; $i <= $sizeX; $i += $sizeX / 52) { DashedLine($im, $i + $shiftX, $shiftYup, $i + $shiftX, $sizeY + $shiftYup, $gray); $period_start = $start + 7 * 24 * 3600 * $j; imagestringup($im, 1, $i + $shiftX - 4, $sizeY + $shiftYup + 32, date('d.M', $period_start), $black); $j++; } $maxY = 100; $tmp = max($true); if ($tmp > $maxY) { $maxY = $tmp; } $minY = 0; $maxX = 900; $minX = 0; for ($i = 0; $i < $weeks; $i++) { $x1 = 900 / 52 * $sizeX * ($i - $minX) / ($maxX - $minX); // imagefilledrectangle($im,$x1+$shiftX,$shiftYup,$x1+$shiftX+8,$sizeY+$shiftYup,imagecolorallocate($im,0,0,0)); // WHITE
function DashedRectangle($image, $x1, $y1, $x2, $y2, $color) { DashedLine($image, $x1, $y1, $x1, $y2, $color); DashedLine($image, $x1, $y2, $x2, $y2, $color); DashedLine($image, $x2, $y2, $x2, $y1, $color); DashedLine($image, $x2, $y1, $x1, $y1, $color); }