【问题标题】:Uncaught TypeError: Object [object Object] has no method 'highcharts' while loading highstock chartUncaught TypeError: Object [object Object] has no method 'highcharts' while loading highstock chart
【发布时间】:2013-11-29 04:35:15
【问题描述】:

加载高库存图表时遇到问题,出现 Uncaught TypeError: Object [object Object] has no method 'highcharts' 错误

$(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)']]
        }
      }]
    });
  });

我已经导入了库 首先是 jquery,然后是 highstock,然后是导出 提前致谢

【问题讨论】:

  • 你能给我们发送 lvie 演示的链接吗,因为代码似乎没问题。

标签: jquery highcharts highstock


【解决方案1】:

在加载 DOM 后使用您的代码,如下例所示:http://jsfiddle.net/bu9V8/

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

【讨论】:

    【解决方案2】:

    尝试这样做:

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-12-25
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-08-30
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多