在requirejs中引用highstock.js会引发错误:无法读取未定义的属性'stockChart'

时间:2019-11-13 13:39:22

标签: highcharts requirejs linechart

您好,我正在使用Highchart库创建折线图。我需要按时间间隔(如日,周,月,季度,年等)生成折线图。因此找到了一些使用Highcharts的Highstocks的示例。我的项目使用requirejs包含脚本。但是我对highstock的js库有一些问题。我不知道我是否想念一些东西。我的代码:

requirejs.config({
    paths: {
      jquery: "js/jquery/jquery",
      "datatables.net": "js/datatables/js/jquery.dataTables.min",
      "datatables.net-css": "js/datatables/css/jquery.dataTables.min",
      tippy: "js/tippy.all.min",
      fixedHeader: "js/datatables/js/dataTables.fixedHeader.min",
      "fixedHeader-css":"js/datatables/css/fixedHeader.dataTables.min",
      jquerymin: "js/jquery-1.10.2.min",
      colpick: "js/colpick",
      colpickcss: "css/colpick",
      highstock: "js/highstock"
    },
    shim: {
      "datatables.net": ["jquery", "css!datatables.net-css"],
      fixedHeader: ["css!fixedHeader-css"],
      colpick: ["css!colpickcss"]
    }
  });
    require.config({
        priority: ["jquery", "jquerymin", "colpick"]
    });
  require([
    "jquery", "tippy",  "DS/3DXHighcharts/3DXHighcharts", "highstock", "datatables.net", "fixedHeader", "jquerymin", "colpick"], 
    function(
    $, tippy, Highcharts, highstock  )

当我尝试生成图表时:

Highcharts.stockChart('container',chartData); 

我收到错误消息:无法读取未定义的属性'stockChart'。

我正在尝试执行以下操作: https://jsfiddle.net/BlackLabel/smbc6gr4/

0 个答案:

没有答案