高图:无法读取未定义的属性“ parts / Globals.js”

时间:2019-04-02 20:28:18

标签: javascript highcharts undefined

我正在使用Highcharts的某些库,但出现以下错误:

  module "s3" {
      source = "../"
   }

    provider "aws" {
      region  = "eu-west-1"
      version = "2.4.0"
    }

我该如何解决? 我正在使用:

Uncaught TypeError: Cannot read property 'parts/Globals.js' of 
undefined
at map.src.js:31
at map.src.js:22
at map.src.js:11

4 个答案:

答案 0 :(得分:4)

面对同样的问题。 Highcharts两天前发布了新版本7.1.0。他们已经修复了导致此错误的issue(10232)。您可以使用https://code.highcharts.com/5.0.14/modules/solid-gauge.js这个特定版本,而不是最新版本。现在对我有用。

答案 1 :(得分:0)

如果遇到此错误,则可能要检查您的应用不是服务器呈现的。 如果是服务器呈现的,则以下内容应解决该问题:

检查highcharts是'object'的一种,因为在服务器上它是'function'的一种。如果它是一个对象,则要执行所需的模块。请参见以下内容:

import Highcharts from 'highcharts/highcharts';
import HighchartsReact from 'highcharts-react-official';
import highchartsBellCurve from 'highcharts/modules/histogram-bellcurve';

if (typeof Highcharts === 'object') {
  highchartsBellCurve(Highcharts); // Execute the bell curve module
}

答案 2 :(得分:0)

是的,我也面临着同样的问题...我已经通过用更新版本的Highcharts JS v7.2.1替换js文件解决了它

答案 3 :(得分:0)

当我尝试使用react-highcharts时发生了。为了解决这个问题,我改用highcharts-react-official

import React from "react";
import { render } from "react-dom";
// Import Highcharts
import Highcharts from "highcharts";
import HighchartSankey from "highcharts/modules/sankey";
import HighchartsWheel from "highcharts/modules/dependency-wheel";
import HighchartsReact from "highcharts-react-official";

HighchartSankey(Highcharts);
HighchartsWheel(Highcharts);

const Viz = () => {
  return (
    <HighchartsReact
      highcharts={Highcharts}
      options={{
        series: [{
          type: "dependencywheel",
          data: [{
            from: "Category1",
            to: "Category2",
            weight: 2
          }, {
            from: "Category1",
            to: "Category3",
            weight: 5
          }]
        }]
      }}
    />
  );
};

render(<Viz />, document.getElementById("root"));