未捕获的TypeError:undefined在使用highcharts时不是函数

jok*_*omo 3 html javascript jquery highcharts

当我尝试使用简单的highcharts示例时,我收到错误:

Uncaught TypeError: undefined is not a function 
Run Code Online (Sandbox Code Playgroud)

此外 :

TypeError: undefined is not a function
at Object.Ya.init (https://code.highcharts.com/highcharts.js:190:496)
at Object.Ya (https://code.highcharts.com/highcharts.js:15:312)
at HTMLDocument.eval (eval at <anonymous> (https://localhost:3000/bower_components/jquery/dist/jquery.js:330:5), <anonymous>:4:15)
at fire (https://localhost:3000/bower_components/jquery/dist/jquery.js:3073:30)
at Object.self.add [as done] (https://localhost:3000/bower_components/jquery/dist/jquery.js:3119:7)
at jQuery.fn.ready (https://localhost:3000/bower_components/jquery/dist/jquery.js:3352:25)
at jQuery.fn.init (https://localhost:3000/bower_components/jquery/dist/jquery.js:2794:16)
at jQuery (https://localhost:3000/bower_components/jquery/dist/jquery.js:76:10)
at eval (eval at <anonymous> (https://localhost:3000/bower_components/jquery/dist/jquery.js:330:5), <anonymous>:1:1)
Run Code Online (Sandbox Code Playgroud)

我的代码是highcharts网站上的简单示例:

  <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script>
Run Code Online (Sandbox Code Playgroud)

<script>
$(function () {

  $('#container').highcharts({
    chart: {
      type: 'bar'
    },
    title: {
      text: 'Fruit Consumption'
    },
    xAxis: {
      categories: ['Apples', 'Bananas', 'Oranges']
    },
    yAxis: {
      title: {
        text: 'Fruit eaten'
      }
    },
    series: [{
      name: 'Jane',
      data: [1, 0, 4]
    }, {
      name: 'John',
      data: [5, 7, 3]
    }]
  });
});

</script>
Run Code Online (Sandbox Code Playgroud)

我也试过里面第一行的版本

var chart = new Highcharts.Chart({
Run Code Online (Sandbox Code Playgroud)

当我打印出Highcharts的内容时,它会给我一个正确的对象.jQuery已加载并正在运行.在这一点上我还能尝试什么?

doo*_*des 8

您需要在highcharts之前加载JQuery.

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script>
<script src="http://code.highcharts.com/highcharts.js"></script>
Run Code Online (Sandbox Code Playgroud)