ovryu
Posts: 18
Joined: Fri Jul 17, 2020 12:04 am

Making highmaps states an href

Hello,

How can I make my highmaps states link to another url using href?

I am able to do so by using dataLabes: formatter() but this only works when using dataLables: enabled true; I would like to make datalabes enabled: false, and still be able to click on the individual states and redirect them to a url.

Am I able to do this?

Code: Select all

dataLabels: {
                enabled: false,
                formatter() {
			return `<a href="https://www.google.com">${this.point.code}</a>`
								}
            },

Here is a link to my jsfiddle: https://jsfiddle.net/nr9u5cj1/1/

Best regards,
dominik.c
Posts: 2081
Joined: Fri Aug 07, 2020 7:07 am

Re: Making highmaps states an href

Hello ovryu!

We appreciate you reaching out to us!

You can use the click function for each point for that. You will no longer have to use dataLabels and there would be an option to redirect the user to another page.

API references:
https://api.highcharts.com/highmaps/ser ... ents.click

Demo:
https://jsfiddle.net/BlackLabel/gv6yw7aq/

Best regards!
Dominik Chudy
Highcharts Developer

Return to “Highcharts Maps”