Highcharts:无法读取未定义的 属性 'parts/Globals.js'
Highcharts: Cannot read property 'parts/Globals.js' of undefined
我正在使用 Highcharts 中的某些库,但出现以下错误:
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
我该如何解决这个问题?
我正在使用:
<script src="https://code.highcharts.com/maps/modules/map.js"></script>
遇到了同样的问题。 Highcharts 发布了一个新版本 7.1.0 two days back. They have fixed an issue(10232) which is causing this error. You can use https://code.highcharts.com/5.0.14/modules/solid-gauge.js 这个特定版本而不是最新版本。它现在对我有用。
如果您遇到此错误,您可能需要检查您的应用是否不是服务器呈现的。
如果它是服务器呈现的,那么以下应该可以解决问题:
检查 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
}
是的,我也遇到了同样的问题...我已经通过用更新版本 Highcharts JS v7.2.1 替换 js 文件解决了这个问题
当我尝试使用 react-highcharts. To resolve this, I switched to 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"));
我正在使用 Highcharts 中的某些库,但出现以下错误:
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
我该如何解决这个问题? 我正在使用:
<script src="https://code.highcharts.com/maps/modules/map.js"></script>
遇到了同样的问题。 Highcharts 发布了一个新版本 7.1.0 two days back. They have fixed an issue(10232) which is causing this error. You can use https://code.highcharts.com/5.0.14/modules/solid-gauge.js 这个特定版本而不是最新版本。它现在对我有用。
如果您遇到此错误,您可能需要检查您的应用是否不是服务器呈现的。 如果它是服务器呈现的,那么以下应该可以解决问题:
检查 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
}
是的,我也遇到了同样的问题...我已经通过用更新版本 Highcharts JS v7.2.1 替换 js 文件解决了这个问题
当我尝试使用 react-highcharts. To resolve this, I switched to 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"));