doucai9270 2014-12-15 11:46
浏览 10

在一周内显示多个堆叠的数据

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.

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 c语言怎么用printf(“\b \b”)与getch()实现黑框里写入与删除?
    • ¥20 怎么用dlib库的算法识别小麦病虫害
    • ¥15 华为ensp模拟器中S5700交换机在配置过程中老是反复重启
    • ¥15 java写代码遇到问题,求帮助
    • ¥15 uniapp uview http 如何实现统一的请求异常信息提示?
    • ¥15 有了解d3和topogram.js库的吗?有偿请教
    • ¥100 任意维数的K均值聚类
    • ¥15 stamps做sbas-insar,时序沉降图怎么画
    • ¥15 买了个传感器,根据商家发的代码和步骤使用但是代码报错了不会改,有没有人可以看看
    • ¥15 关于#Java#的问题,如何解决?