srdixit
Posts: 8
Joined: Thu Feb 08, 2018 5:35 pm

Highmaps drilldown to country > states > city

I have created an example in jsfiddle:
https://jsfiddle.net/vtk31541/8/

I can able to drilldown on world map and now I can access to click on any specific country to that map. But in particular country I couldn't see the data on the states. Dont know where I am doing wrong. Please refer my data set and help me to fix this.
ppotaczek
Posts: 751
Joined: Mon Oct 02, 2017 3:12 pm

Re: Highmaps drilldown to country > states > city

Hi srdixit,

Here you only add data for countries from 'response' variable:

Code: Select all

    $.each(response.COUNTRIES, function(index, feature) {
      countryData.push({
        key: feature.Code,
        value: feature.CountryIncidentCount
      });
    });
So in 'countryData' you have always values for USA and India. I think that you should add values for others subjects in similar way:

Code: Select all

    if ($('#mapDropdown').val() == "countries/in/in-all.js") {
      $.each(response.COUNTRIES[0].STATES, function(index, feature) {
        countryData.push({
          key: feature.Code,
          value: feature.StateIncidentCount
        });
      });
    }
Live demo: https://jsfiddle.net/BlackLabel/hpoatjy5/

Best regards!
Paweł Potaczek,
Highcharts Developer
sgupta1
Posts: 8
Joined: Mon Aug 29, 2022 5:48 am

Re: Highmaps drilldown to country > states > city

Can u do something for city level. After clicking on state to display city level map(1 more level deeper)?
hubert.k
Posts: 1164
Joined: Mon Apr 11, 2022 11:48 am

Re: Highmaps drilldown to country > states > city

Hi sgupta1!
Welcome to our forum and thanks for contacting us with your question!

Unfortunately, we do not provide maps of all countries on Administration Level 1 or Administration Level 2. Only a few countries have these maps generated, you can find, which country has admin1 and admin2 levels here: https://code.highcharts.com/mapdata/

Here you can find a similar official demo of drilling-down from admin 1 to admin 2 states in the USA: https://jsfiddle.net/gh/get/library/pur ... -drilldown

Best regards!
Hubert Kozik
Highcharts Developer
sgupta1
Posts: 8
Joined: Mon Aug 29, 2022 5:48 am

Re: Highmaps drilldown to country > states > city

https://jsfiddle.net/gh/get/library/pur ... o/all-maps

In above drilldown map data display from country to state level .but I want after clicking state it drilldown to city .This is my requirement.
It is possible or even if paid that's also useful
hubert.k
Posts: 1164
Joined: Mon Apr 11, 2022 11:48 am

Re: Highmaps drilldown to country > states > city

sgupta1,
In the demo you have sent, the feature you are describing is working just as you want. If you first click, on the world map, on the United States of America, you will see the states of this country, then if you click on the state, e.g. Texas you will see the cities in that state. I am also attaching a GIF of that operation, you can check it below.

GIF: https://gfycat.com/dimwittedfrankkangaroo

Kind regards!
Hubert Kozik
Highcharts Developer
sgupta1
Posts: 8
Joined: Mon Aug 29, 2022 5:48 am

Re: Highmaps drilldown to country > states > city

Okay...I have saw in India ..In India its not working after click on state it does not display city..
you mean to say for every countries its not display city(like INDIA) right?
hubert.k
Posts: 1164
Joined: Mon Apr 11, 2022 11:48 am

Re: Highmaps drilldown to country > states > city

sgupta1, yes, as I said in previous posts, sadly, there is no admin1 or admin2 map for India. If you would like to see a detailed India map you can create a feature request here: https://github.com/highcharts/map-colle ... ist/issues

You can also create your own map by following these articles:
https://www.highcharts.com/docs/maps/create-custom-maps
https://www.highcharts.com/docs/maps/cu ... ojson-maps

Regards!
Hubert Kozik
Highcharts Developer
sgupta1
Posts: 8
Joined: Mon Aug 29, 2022 5:48 am

Re: Highmaps drilldown to country > states > city

okay hubert.k .
Thank you so much clearing my doubt
hubert.k
Posts: 1164
Joined: Mon Apr 11, 2022 11:48 am

Re: Highmaps drilldown to country > states > city

You're welcome! In case of any further questions, feel free to contact us again.
Hubert Kozik
Highcharts Developer

Return to “Highcharts Maps”