Highcharts: Cannot read property 'parts/Globals.js' of undefined

断了今生、忘了曾经 提交于 2019-12-23 19:43:46

问题


I am using certain libraries from Highcharts and I get the following error:

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

How can I fix this? I am using:

<script src="https://code.highcharts.com/maps/modules/map.js"></script>

回答1:


Faced the same issue. Highcharts released a new version 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 this particular version instead of the latest one. It's working for me now.




回答2:


If you encounter this error, you might want to check that your app is not server rendered. In the case that it is server rendered then the following should fix the issue:

Check that highcharts is a type of 'object', because on the server it is of type 'function'. If it is an object then you want to execute the module you want. Kindly see below:

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
}


来源:https://stackoverflow.com/questions/55483079/highcharts-cannot-read-property-parts-globals-js-of-undefined

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!