user2963966
user2963966

Reputation: 13

Uncaught TypeError: Object [object Object] has no method 'highcharts' while loading highstock chart

Facing problem while loading high stock chart, getting Uncaught TypeError: Object [object Object] has no method 'highcharts' error

$(divId).highcharts('StockChart', {

        rangeSelector: {
                enabled: true,               
            buttonTheme: 
                      { 
                        width:50,
                        height:20
                      },
            inputEnabled : false
            },
        exporting: {
                enabled: false
            },
        navigator: {
                enabled: false
            },
        scrollbar: {
                enabled: false
            }, 

        chart : {
            events: {
                  click: function(event) {     
                }
            },   
          pinchType : 'none',
           zoomType : 'none'
       },
      title : {
        text : 'AAPL Stock Price'
      },

      series : [{
        name : 'AAPL Stock Price',
        data : data,
        type : 'area',
        threshold : null,

        enableMouseTracking: false,
        fillColor : {
          linearGradient : {
            x1: 0, 
            y1: 0, 
            x2: 0, 
            y2: 1
          },
          stops : [[0, Highcharts.getOptions().colors[0]], [1, 'rgba(0,0,0,0)']]
        }
      }]
    });
  });

I have imported the libraries first jquery then highstock and then exporting Thanks in advance

Upvotes: 0

Views: 2909

Answers (2)

Rub21
Rub21

Reputation: 819

Try to do it this way:

<script src="http://code.jquery.com/jquery-1.9.0.js"></script>
<script src="http://code.highcharts.com/highcharts.js"></script>
<script src="http://code.highcharts.com/modules/exporting.js"></script>

jQuery-1.9.0.js library.

Upvotes: 0

Paweł Fus
Paweł Fus

Reputation: 45079

Use your code after DOM is loaded, like in this example: http://jsfiddle.net/bu9V8/

$(function () { // call code below, after document is loaded
  $("#container").highcharts('StockChart', {
    series: [{
      data: [5, 10]
    }]
  });
});

Upvotes: 1

Related Questions