highcharts / map-collection-dist

Other
30 stars 37 forks source link

How to import all maps #31

Closed pavitran777 closed 5 years ago

pavitran777 commented 5 years ago

Since there is not a way to dynamically import maps individually, is there a way to import all maps say in the countries folder?

KacperMadej commented 5 years ago

Hi @pavitranrambo

After you will install the NPM module all maps will be downloaded into the related directory in node_modules. Single map usage is described in docs: https://github.com/highcharts/map-collection-dist#install-from-npm

pavitran777 commented 5 years ago

Hello KacperMadej,

I have done what you have described. However, my problem is I want the user to be able to choose what country they want during runtime.

Currently, I do not know a way to import specific geojson files through the use of variables or conditional statements.

So the only other way I can think of is to import all the geojson files into the script I am working on all at once. Is there any way to do that?

KacperMadej commented 5 years ago

You could load the map files dynamically. Here's a demo loading maps from CDN (code.highcharts.com/mapdata/) - https://jsfiddle.net/gh/get/library/pure/highcharts/highcharts/tree/master/samples/maps/demo/map-drilldown/ Another example can be found here: https://www.highcharts.com/maps/demo/all-maps

fatimasajjad commented 5 years ago

I follow the demo/all-maps link in angular typescript project but I get exception at Highcharts.geojson and also Highcharts.mapDataIndex is undefined.

Please answer the following issue:

https://github.com/highcharts/highcharts/issues/10069

KacperMadej commented 5 years ago

Let's continue on Highcharts repo issue to avoid duplication

KacperMadej commented 5 years ago

@fatimasajjad case is moved to Highcharts main repo

The original issue is answered and will now be closed due to inactivity (IMHO it's resolved).