Uncaught TypeError: undefined is not a function when using tall charts

When I try to use a simple example of add-ins, I get the error:

Uncaught TypeError: undefined is not a function 

      

In addition to:

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)

      

My code is a simple example on the highcharts website:

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

      

<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>

      

I also tried the version where the first line is inside

var chart = new Highcharts.Chart({

      

When I type what Highcharts are, it gives me the correct object. jQuery is loaded and working. What else can I try at this stage?

+3


source to share


2 answers


You need to load JQuery before doing the older ones.



<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>

      

+8


source


Ok, this problem was really simple. In the earlier code, a script shortcut was loaded which was in conflict with the injection on that line.



If you notice this error, check to see if the high-level charts have already been entered.

0


source







All Articles