I want to create take a start and end date, then break it up into weeks, and using these weeks i want to check how many low , medium, high results there was in those weeks and display them in a stacked bar chart.
My code is working perfectly fine and showing the correct results between start dates and end dates but doesn't know how to display those data into weeks. For example, for Week1, I would get a column stacked with a result of how many low, medium and high was for this week. and so on. My problem quite similar to this question but the solution that were given just totally not correct.
Any ideas or examples have you came across.
Here is my PHP code
<?php>
$result = mysqli_query($con,"SELECT * FROM `patients` WHERE `DateofTest` BETWEEN '" . $_POST
['start'] . "' AND '" . $_POST ['end'] . "' ") or die ("Error: ".mysqli_error($con));
$risks = 0;
$BergRiskRatingcounter = 0;=0;
$countermedium=0;
$counterlow=0;
while($row = mysqli_fetch_array($result))
{
$answer = $row['Risk'];
$low = 'Low';
$medium='Medium';
$High='High';
if ($answer == $low)
{
$counterlow++;
}
if($answer == $medium)
{
$countermedium++;
}
if($answer == $high)
{
$counterhigh++;
}
$BergRiskRatingcounter++;
}
mysqli_close($con);
?>
Here is my JS Libraries I am using in my program.
Here is my JavaScript Code.
$(function() {
var series = [<?php echo $output; ?>];
$.plot("#placeholder", series, {
series: {
stack:true,
lines:{fill:true,show:false,steps:false},
bars: {
show: true,
barWidth: 0.8,
align: "middle",
},
},
xaxis: {
mode: "categories",
minTickSize: 1
}
});
});
Any ideas or examples please.