小编Mar*_*ito的帖子

HighCharts通过Json加载数据

我正在尝试从我的Json Data制作HighCharts图表.这是我的Json数据

[{"ReadData":"99","Time":"07\/09\/2015 00:00:07"},{"ReadData":"101","Time":"07\/09\/2015 00:01:07"},{"ReadData":"113","Time":"07\/09\/2015 00:02:07"},{"ReadData":"115","Time":"07\/09\/2015 00:03:07"},{"ReadData":"96","Time":"07\/09\/2015 00:04:07"},{"ReadData":"103","Time":"07\/09\/2015 00:05:07"}]
Run Code Online (Sandbox Code Playgroud)

我的问题是当图表没有加载时,我做错了什么?这是我的代码HTML.

<html>
    <head>
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
    <script src="http://code.highcharts.com/highcharts.js"></script>
    <script src="http://code.highcharts.com/modules/exporting.js"></script>
    <div id="container" style="min-width: 310px; height: 400px; margin: 0 auto"></div>
     <script>

        $(document).ready(function() {

    var options = {
        chart: {
            renderTo: 'container',
            type: 'spline'
        },
        series: [{}]
    };

    $.getJSON('data.json', function(data) {
        options.xAxis.categories = json[0]['Time'];
        options.series[0] = json[0]['ReadData'];
        var chart = new Highcharts.Chart(options);
    });

});
    </script>         
    </head>
</html>
Run Code Online (Sandbox Code Playgroud)

jquery json highcharts

1
推荐指数
1
解决办法
4863
查看次数

标签 统计

highcharts ×1

jquery ×1

json ×1