bangkalog
Posts: 31
Joined: Fri Jul 19, 2019 5:31 am

How to draw lines between country

I am trying to make route similar to this one https://jsfiddle.net/gh/get/library/pur ... ht-routes/

But I need is by country eg. canada to france. I'm using custom/world chart almost like this one https://jsfiddle.net/z6pLk9bw/
rafalS
Posts: 2665
Joined: Thu Jun 14, 2018 11:40 am

Re: How to draw lines between country

Hi,

Welcome to our forum and thanks for contacting us.

As you can see in the example above, flight routes are lines with a path connecting two map points coordinates. You get their coordinates using chart.get('mappointID') method. You cannot connect 2 countries.

You can add fake map points on country coordinates, disable mouse tracking on them and then connect point on Canada with a point on France.

jsFiddle: https://jsfiddle.net/BlackLabel/f9pzn3d4

Let me know if you have any further questions.

Best regards!
Rafal Sebestjanski,
Highcharts Team Lead
bangkalog
Posts: 31
Joined: Fri Jul 19, 2019 5:31 am

Re: How to draw lines between country

Thank you so much it is very helpful.
gfrancis
Posts: 1
Joined: Fri Mar 11, 2022 4:25 pm

Re: How to draw lines between country

What about this map?

https://jsfiddle.net/gh/get/library/pur ... projection


it has a line from 2 countries
I wish there was a way to make it a flat map and not a globe
mateusz.b
Posts: 2006
Joined: Tue Jul 13, 2021 11:34 am

Re: How to draw lines between country

Hi gfrancis,

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

To make the map flat you need to remove Orthographic projection.
Demo: https://jsfiddle.net/BlackLabel/3wmjzset/

Let me know if that was what you were looking for!
Regards!
Mateusz Bernacik
Highcharts Developer

Return to “Highcharts Maps”