Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/json/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Highcharts PhpMySQL:加载空白页而不是图表-如何在Highcharts中呈现动态json数据_Php_Json_Highcharts - Fatal编程技术网

Highcharts PhpMySQL:加载空白页而不是图表-如何在Highcharts中呈现动态json数据

Highcharts PhpMySQL:加载空白页而不是图表-如何在Highcharts中呈现动态json数据,php,json,highcharts,Php,Json,Highcharts,我正在尝试将动态数据加载到div中。我已经有了如下所示的json数据 [{"name":"count","data":[94797,77957,85095,81528,78494]},{"name":"net","data":[270205,220410,237440,227395,217985]},{"name":"principal","data":[4.01,0.14,250677.74,228381.02,219001.12]}] 下面是我的代码。请协助诊断问题可能出现的位置

我正在尝试将动态数据加载到div中。我已经有了如下所示的json数据

[{"name":"count","data":[94797,77957,85095,81528,78494]},{"name":"net","data":[270205,220410,237440,227395,217985]},{"name":"principal","data":[4.01,0.14,250677.74,228381.02,219001.12]}]
下面是我的代码。请协助诊断问题可能出现的位置

    <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js" type="text/javascript"></script>
    <script src="http://code.highcharts.com/highcharts.js"></script>
    <script src="http://code.highcharts.com/modules/exporting.js"></script>
   <script type="text/javascript">

   $(function () {
                   var chart;        
       $(document).ready(
                         function() {
                          $.getJSON("graph_dpr.php", 
                        function(json) {

                                        chart = new Highcharts.Chart({
                                            chart: {
                                                renderTo: 'container',
                                                type: 'line',
                                                marginRight: 130,
                                                marginBottom: 25
                                        },
                                        title: {
                                            text: 'DPR graph',
                                            x: -20 //center
                                        },
                                        subtitle: {
                                            text: '',
                                            x: -20
                                        },
                                        xAxis: {
                                            categories: ['2014-02-01', '2014-02-02', '2014-02-03', '2014-02-04', '2014-02-05']
                                        },
                                        yAxis: {
                                            title: {
                                                text: 'Principal_Lent'
                                            },
                                            plotLines: [{
                                                value: 0,
                                                width: 1,
                                                color: '#808080'
                                            }]
                                        },
                                        tooltip: {
                                            formatter: function() {
                                                    return '<b>'+ this.series.name +'</b><br/>'+
                                                    this.x +': '+ this.y;
                                            }
                                        },
                                        legend: {
                                            layout: 'vertical',
                                            align: 'right',
                                            verticalAlign: 'top',
                                            x: -10,
                                            y: 100,
                                            borderWidth: 0
                                        },
                                        series: json
        });
    });

});
});

该图表应加载在主体标签内下方的div中

<div id="container" style="min-width: 400px; height: 400px; margin: 0 auto"></div>

请注意:graph_dpr.php是我检索json数据的页面。

是否使用json编码和启用标志json_NUMERIC_CHECK?你在控制台中收到任何错误吗?我是说开发工具,比如Chrome。是的,Sebastian,我用过。请看下面的代码$结果=数组;数组\u push$result,$rows;数组_push$result,$rows1;数组_push$result,$rows2;打印json_encode$result,json_NUMERIC_CHECK;我想您应该使用Web服务器来获取数据,因为$.getJSON不适用于本地文件系统。