HighCharts在Laravel中没有显示时间值

时间:2015-01-13 13:26:27

标签: jquery ajax laravel-4 highcharts

我开发了一个带有highcharts的laravel web应用程序。 我正在收集一个mysql时间字段以在高级图表中显示,值为

["40:30:09","58:24:25","25:09:25"]

我的代码是:

<script type="text/javascript">
$(".genchart").click(function(){
    $.ajax({
                type: "POST",
                url : "getchart",
                success : function(data){
                            $('#container').highcharts({
                                chart: {
                                    type: 'column'
                                },
                                title: {
                                    text: 'Monthly Work Report'
                                },
                                subtitle: {
                                    text: 'Source: My Own'
                                },
                                xAxis: {

                                    categories: [
                                        '1',
                                        '2',
                                        '3',
                                        '4',
                                        '5',
                                        '6',
                                        '7',
                                        '8',
                                        '9',
                                        '10',
                                        '11',
                                        '12'
                                    ]
                                },
                                yAxis: {
                                    min: 0,
                                    title: {
                                        text: 'Rainfall (mm)'
                                    }
                                },
                                tooltip: {
                                    headerFormat: '<table>',
                                    pointFormat: '<tr>' +
                                        '<td style="padding:0"><b>{point.y:.2f} mm</b></td></tr>',
                                    footerFormat: '</table>',
                                    shared: true,
                                    useHTML: true
                                },
                                plotOptions: {
                                    column: {
                                        pointPadding: 0.2,
                                        borderWidth: 0
                                    }
                                },
                                credits: {
                                    enabled: false
                                },
                                series: [{
                                    name: 'Tokyo',

                                    data: data

                                }]
                            });  
                }
            },"json");



    });
    </script>

Ajax控制器:

 public function getChart()
   {

    $user_id=Auth::user()->id;

    $results=DB::table('tasks')
    ->leftJoin('users', 'tasks.created_by', '=', 'users.id')
    ->where('tasks.assignee', '=', $user_id)
    ->where('tasks.status', '>', 0)
    ->get();

    foreach ($results as $result)
    {
        $categoryArray[] = $result->elapsed_time;

    }

    return Response::json($categoryArray);

}

获取类似enter image description here

的图表输出

我如何解决这个问题。我想在图表中获得时间

谢谢&amp;此致

0 个答案:

没有答案