ericplan
Posts: 91
Joined: Thu Apr 11, 2019 8:24 pm

Hyperlink style/color

On my chart there is a hyperlink in the subtitle. The subtitle is formatted to be in a color, but I cannot find ho to format the hyperlink to appear in the same color. Unfortunately the search option is limited, the word url is ignored, so no searching for the combo url and color. Hyperlink and color didn't give the answer, and my search in the docs was not successful.

So the simple question is: how to format a hyperlink in a subtitle in the same color as the rest?
Regards,

Eric from Amsterdam
jakub.s
Posts: 1229
Joined: Fri Dec 16, 2022 11:45 am

Re: Hyperlink style/color

Hi Eric,

Thanks for the question!

I know it might be a little confusing at first, but Highcharts charts render as SVGs and the text inside your link is probably a tspan so in order to change the color of this text you need to set the fill property, not the color property.

Here's a demo: https://jsfiddle.net/BlackLabel/17j48fc5/

Please take a look at CSS. You can add your own color there and you'll notice that it applies to the link.

Let me know if you have any more questions.

Kind regards!
Jakub
Highcharts Developer
ericplan
Posts: 91
Joined: Thu Apr 11, 2019 8:24 pm

Re: Hyperlink style/color

Hi Jakub,

I tried the Fiddle, replicated it to my css, even marked it important, but the hyperlink in the subtitle stays black, while the rest is blue. Any other suggestions?
Regards,

Eric
Regards,

Eric from Amsterdam
jakub.s
Posts: 1229
Joined: Fri Dec 16, 2022 11:45 am

Re: Hyperlink style/color

Hi Eric,

Could you please try to reproduce this so I could take a look? I'm afraid that only then will I be able to help.

Best regards!
Jakub
Highcharts Developer
ericplan
Posts: 91
Joined: Thu Apr 11, 2019 8:24 pm

Re: Hyperlink style/color

Hi Jakub,

I'm going to do some research myself. Didn't know I got an older version of the same website with working blue hyperlinks! When I find something remarkable I will post it here.

Regards,

Eric
Regards,

Eric from Amsterdam
ericplan
Posts: 91
Joined: Thu Apr 11, 2019 8:24 pm

Re: Hyperlink style/color

I found a solution. My charts are mostly generated in PHP. The hyperlink is also generated in PHP. I used this code to get my custom link color:

Code: Select all

$maxlink = '<a href= '/pages/day_overview.php' . $day . 'dag=' . $nicedate . '><span style="font-family:Arial,Verdana;font-size:12px;font-weight:12px;color:' .$colors['color_text_subtitle'].' ;">'. $nicedate .'</span></a>';
Thanks for pointing me to a solution.

Regards,

Eric
Regards,

Eric from Amsterdam

Return to “Highcharts Usage”