0

我正在尝试让这个 Highchart 演示图表在我的本地 Web 服务器上工作:http ://www.highcharts.com/stock/demo/basic-line

我不确定我做错了什么,但它根本不会加载到任何浏览器中。

这是我放在 index.html 中的代码:

<!DOCTYPE HTML>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
        <title>Highcharts Example</title>

    <script src="http://code.highcharts.com/stock/highstock.js"></script>
    <script src="http://code.highcharts.com/stock/modules/exporting.js"></script>
    <script type="text/javascript">
$(function() {

    $.getJSON('http://www.highcharts.com/samples/data/jsonp.php?filename=aapl-c.json&callback=?', function(data) {
        // Create the chart
        $('#container').highcharts('StockChart', {


            rangeSelector : {
                selected : 1
            },

            title : {
                text : 'AAPL Stock Price'
            },

            series : [{
                name : 'AAPL',
                data : data,
                tooltip: {
                    valueDecimals: 2
                }
            }]
        });
    });

});
        </script>
    </head>
    <body>
    <div id="container" style="height: 500px; min-width: 500px"></div>
    </body>
</html>

我究竟做错了什么?

谢谢!

4

1 回答 1

0

我在您的页面中没有看到 jQuery,请尝试添加:

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script>

Highcharts 需要 jQuery、MooTools 或 Prototype

于 2013-05-24T13:53:06.730 回答