<?php function graphImage($numachieved, $weektarg)
{
//working out how many days are in the month
$day = (date('t')/4.33333);
//week1
$day1 = $day;
//week2
$day2 = ($day*2);
//week3
$day3 = ($day*3);
//week4
$day4 = ($day*4);
//tagert for the week
$perWeek = $numachived;
//height of graph
$numtarg = ($weektarg*1);
$numtarg2 = ($weektarg*2);
$numtarg3 = ($weektarg*3);
$numtarg4 = ($weektarg*4);
switch (true) {
case ((date('j') < $day1) && ($perWeek > $numtarg)): ;
echo "<img src='images/grid_stats.jpg' alt='grid' height=' ".($numachieved * 5)." ' width='20' />";
break;
case ((date('j') > $day1) && (date('j') < $day2) && ($perWeek > $numtarg)): ;
echo "<img src='images/grid_stats.jpg' alt='grid' height=' ".($numachieved * 5)." ' width='20' />";
break;
case ((date('j') > $day2) && (date('j') < $day3) && ($perWeek > $numtarg2)):
echo "<img src='images/grid_stats.jpg' alt='grid' height=' ".($numachieved * 5)." ' width='20' />";
break;
case ((date('j') > $day3) && (date('j') < $day4) && ($perWeek > $numtarg3)):
echo "<img src='images/grid_stats.jpg' alt='grid' height=' ".($numachieved * 5)." ' width='20' />";
break;
case ((date('j') > $day4) && ($perWeek > $numtarg4)):
echo "<img src='images/grid_stats.jpg' alt='grid' height=' ".($numachieved * 5)." ' width='20' />";
break;
default:
echo "<img src='images/grid_stats2.jpg' alt='grid' height=' ". ($numachieved * 5)." ' width='20' />";
}
}
?>
Hey Guys,
Im new to PHP,
Im creating a little performance graph for some consultants,
The graph consists of 14 tasks, it`s a bar graph.
The Problem i`m having is that i need to display 2 images.
A blue bar if they are on the right target for the set week in the month and a red bar if they are of course. The graph never seems to have both. if i put switch = true then it finds all the cases to be false, if i put switch = false then it finds all the cases to be "true" in the aspect that it is all false,
Can anyone please help me correct my code.
Thanks in advance!