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>
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
}
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With