Highcharts不显示:“undefined不是函数”

时间:2015-02-03 15:00:17

标签: javascript jquery asp.net razor highcharts

我正在尝试从here运行示例,但它没有显示。在我的浏览器控制台中,错误出现在第

<script type="text/javascript">
    $(function () {
        $('#container').highcharts({

未定义不是函数,而最后一行被加下划线为错误。

以下是我从.cshtml页面运行脚本的方法。

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

</head>

<body>

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


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

    <script type="text/javascript" src="http://code.highcharts.com/highcharts.js"></script>
    <script type="text/javascript" src="http://code.highcharts.com/modules/exporting.js"></script>   


    <script type="text/javascript">
        $(function () {
            $('#container').highcharts({
                chart: {
                    type: 'column'
                },
                title: {
                    text: 'Column chart with negative values'
                },
                xAxis: {
                    categories: ['Apples', 'Oranges', 'Pears', 'Grapes', 'Bananas']
                },
                credits: {
                    enabled: false
                },
                series: [{
                    name: 'John',
                    data: [5, 3, 4, 7, 2]
                }, {
                    name: 'Jane',
                    data: [2, -2, -3, 2, 1]
                }, {
                    name: 'Joe',
                    data: [3, 4, 4, -2, 5]
                }]
            });
        });    
    </script>

</body></html>

1 个答案:

答案 0 :(得分:0)

适用于最新的Chrome,Firefox和IE