I am looking at the react highmaps documentation and it seems like they have hardcoded/saved the map data:
https://github.com/kirjs/react-highcharts https://github.com/kirjs/react-highcharts/tree/master/demo/src/mapdata
I see in a lot of little tutorials though that the data comes from high maps itself by just passing a key like this
mapData: Highcharts.maps['custom/world'],
See example here: http://jsfiddle.net/gh/get/jquery/3.1.1/highcharts/highcharts/tree/master/samples/maps/tooltip/usehtml/
But given that I am writing a pure reactJS/ nodeJS app, I was wondering if there is a way in pure react to pull in the path data for world maps? Is this deployed to react high maps somewhere?
According the official Highcharts documentation you have to manualy include the map script:
As you can see in the fiddle you mentioned, they included the map with the script tag:
Because of the above script include, the map is available in
Highcharts.maps['custom/world']
.So in the React module you have to manually add the desired maps, like in the demo you mentioned. For example, if you want to add the World map, then:
Highcharts.maps["custom/world"] =
withmodule.exports =
in the above file.const map = require('./maps/world');
mapData: map
I understand that you want to skip the above process, but currently there isn't any React module that includes the map.
Actually there is a hackish way you can do it ... In your html file, where the react scripts are included, there you can include world.js script tag, but first you have to make sure that Highcharts.maps object array exist. In that fashion you'll use the maps externally.
However this is a bad practice, because of your React's components will be dependend on that map script.
Good practice is to manage your vendor modules via package manager and reference the modules in the components. In that way the components are self-descriptive
I find another ways to render the map.
From highcharts forum example
Basically call the js source url to create the map, but I prefer use Jordan Enev's way.
After I take a look, highcharts already gave the map collection, you can install the dependency @highcharts/map-collection example
After that you can try
This issue already raise on this issue
Cheers,