0

我正在使用高图表来比较每位患者的等待时间和出院时间。

例如:

Patient ID   Expected Time    Waiting Time
2            2 hours          1 hour 

我有一个数据库连接来获取这些时间:

$query2 = "SELECT PatientID,Forename, Patient.Illness, Patient.Priority, Arrival_time, MY_TIME() AS now, ABS( TIMEDIFF( MY_TIME( ) , Arrival_time ) ) AS Waiting_Time, TIME_TO_SEC( Expected_time) as Expected_time , TIME_TO_SEC( Discharge_time )  as Discharge_time, Examined
FROM Patient, priority_time
WHERE Patient.Illness = priority_time.Illness
AND Patient.Priority = priority_time.Priority;";
$result2 = mysqli_query($conn, $query2) or die("Invalid query: ".$query2); 

我想在 X 轴上显示患者 ID,在 Y 轴上显示等待时间。

问题:

Converting Time to display in this format: hours: minutes: seconds on Y axis.

这是我的代码:

<html>
    <head>
    <script src="http://code.jquery.com/jquery-1.7.1.min.js"></script>
    <script src="js/highcharts.js"></script>
    <script type="text/javascript">
        function drawChart(){
            var chart = new Highcharts.Chart({
                chart: {
                    renderTo: 'divforchart',
                    type:'column',
                },
                xAxis: {
                    name:'patients',
                    categories: ['Juan','Pepe','Paco']
                },
                yAxis: {
                    type: 'datetime'
                },

                series: [
                    {
                        name: 'Arrival time',
                        data: [
                            ['Juan',Date.UTC(2012,4,18,11,0)], 
                            ['Pepe',Date.UTC(2012,4,18,11,0)], 
                            ['Paco',Date.UTC(2012,4,18,11,0)] 
                        ]
                    },
                    {
                        name: 'Expected time',
                        data: [
                            ['Juan',Date.UTC(2012,4,18,12,00)], 
                            ['Pepe',Date.UTC(2012,4,18,13,00)], 
                            ['Paco',Date.UTC(2012,4,18,11,15)]
                        ]
                    }
                ]
            });
        }
    </script>
    </head>
    <body onLoad="drawChart()">
     <div id="divforchart" style="height: 400px"></div>
    </body>

编辑: 可视化

4

0 回答 0