Strgt
Posts: 37
Joined: Fri Dec 03, 2021 2:11 pm

Simultaneous update of map and drilldownvalues

Hello,

I have a world map that changes the value of continents and countries as the years change. When I select a year and change the values of the countries and drill back up to the main map (continents), the value of the continents is not updated and shows the previous values. What should I do to coordinate between updating the continents and countries?

Hier ist ein ähnliches Beispiel: https://jsfiddle.net/5erjg4yx/
And my code to change the values with years :
chart.series[0].data.forEach((d, i) => {
d.drilldown = `custom/${d.properties['name'].toLowerCase().replace(' ', '-')}`;
// d.value = App.Constants.getDataWorld.find(v => v[0] === d.properties['hc-key'])[1];
const val = myData.find(v => v[0] === d.properties['hc-key']);
d.value = val ? val[1] : null;

});

Thank you in advance for your help.

Sincerely yours
jakub.j
Posts: 1091
Joined: Tue Jan 24, 2023 11:14 am

Re: Simultaneous update of map and drilldownvalues

Hello,

I managed to coordinate changes between continents and countries using a variable that is changing on button click. I created a method that iterates through the points and updates their value. This method is invoked on button click and also on drilldown, drillup to synchronize the changes.

Live demo: https://jsfiddle.net/BlackLabel/5gaxj7bc/

Let me know if you have any further questions!
Regards
Jakub
Strgt
Posts: 37
Joined: Fri Dec 03, 2021 2:11 pm

Re: Simultaneous update of map and drilldownvalues

Hello,

Unfortunately, with the change of years in my code, when I change the values of the countries and return to the continents, the values of the continents have not changed. I still have to work on it.
But I would be grateful if you could answer another question.
I want to have pie charts on the continents map like on the countries map. And the size of the pie charts changes both on the continents and the countries when the values change.
Live demo: https://jsfiddle.net/BlackLabel/5gaxj7bc/

Thank you in advance for your help.

Sincerely yours
jakub.j
Posts: 1091
Joined: Tue Jan 24, 2023 11:14 am

Re: Simultaneous update of map and drilldownvalues

Hey,

I managed to achieve the solution that you wanted. I modified your solution so that the bubbles appear on countries map and continents map and they change their values when you click the buttons.

Live demo: https://jsfiddle.net/BlackLabel/dnf7h9sk/

Best regards
Jakub
Strgt
Posts: 37
Joined: Fri Dec 03, 2021 2:11 pm

Re: Simultaneous update of map and drilldownvalues

Hello,

Thanks for your response. This demo you send me doesn't work correctly for all countries and continents and doesn't change the size of the donut chart properly. At first, there is no pie chart on the continents map. Also, the program hangs when the year changes.
Live demo: https://jsfiddle.net/BlackLabel/dnf7h9sk/

P.S. There is always an additional tooltip that I can't remove it: https://jsfiddle.net/BlackLabel/u105mcsw/
secondTooltip.png
secondTooltip.png (36.16 KiB) Viewed 613 times

Thank you in advance for your help.


Best regards
jakub.j
Posts: 1091
Joined: Tue Jan 24, 2023 11:14 am

Re: Simultaneous update of map and drilldownvalues

Hey,

I prepared a fixed demo, now pies appear on chart load, and the size is changed properly.
I disabled the tooltip when hovering on the wrong series.

Live demo: https://jsfiddle.net/BlackLabel/edu8f6kL/

Best regards
Jakub

Return to “Highcharts Maps”