yepecece
Posts: 6
Joined: Tue Sep 18, 2018 9:50 am

Set color for border between 2 countries

Hi,

I am trying to achieve a map with borders between countries to be different colours (for example border between mexico and USA to be red).

Is there a quick way to do this or would I need to add custom paths for each border I want to add?
If that is the case what would be the quickest way to find the path values for the border?

Thanks for your help
rafalS
Posts: 2665
Joined: Thu Jun 14, 2018 11:40 am

Re: Set color for border between 2 countries

Hi,

It is possible without changing paths, but you will need to change your series. Look at this example: https://jsfiddle.net/BlackLabel/wrhud9ov/

I was able to change the whole border of Poland to red, and playing with zIndex property I was able to show only a piece of the red border of Poland that borders with countries from the same series (dark grey color). So, e. g. if I wanted to color the border between Poland and Germany, I would need to keep Poland and Germany in one series and put all other countries to separate series.

But that is not the end of our problems - notice that when we hover over Poland, border disappears. We could set plotOptions.series.enableMouseTracking property to false or find other solution that would allow us to use a tooltip and would not affect on a border.

Kind regards,
Rafał
Rafal Sebestjanski,
Highcharts Team Lead
yepecece
Posts: 6
Joined: Tue Sep 18, 2018 9:50 am

Re: Set color for border between 2 countries

Hi,

Thanks for you feedback.
The problem is that the north border of Poland (along the sea) is also red.

If I go with the “additional path” option do you know a fast way to get the intersect values between Germany and Poland?

Thanks again
rafalS
Posts: 2665
Joined: Thu Jun 14, 2018 11:40 am

Re: Set color for border between 2 countries

Hi again,

We have been discussing this for the last two hours and we came up with some ideas, but unfortunately, none of them was good enough and fully working in all cases. The effective enough algorithms comparing two common parts of paths are really hard to implement and would take a lot of time. I can not even tell you for this moment, which one would be the best and the fastest, because it is too complicated and unpredictable.

You can always contact the Black Label company (they are experts in Highcharts) and ask them to make a custom project for you.

I am really sorry I can not help you more at this moment.

Kind regards,
Rafał

ps. when it comes to specific countries, you can always find the common path manually and there should be no bigger problems with that.
Rafal Sebestjanski,
Highcharts Team Lead
yepecece
Posts: 6
Joined: Tue Sep 18, 2018 9:50 am

Re: Set color for border between 2 countries

Hi Rafal,

thanks for you time.
I am trying to manually find the intersection between 2 countries. I am using inkscape to manually select the border.
However when I try to overlay the path on top of a map it is not correct even though I am using the same source map.

see here
http://jsfiddle.net/aksyvd6f/

I have tried using this:
http://jsfiddle.net/gh/get/jquery/1.7.2 ... ordinates/

But when if I load another map (World, Robinson Projection, Highres) and I click get series configuration I get an error 404.

Thanks

Return to “Highcharts Maps”