ingezone
Posts: 28
Joined: Mon Feb 01, 2021 3:16 am

Formatting the Tooltip to display days of the week

Hi

I have a small application that displays the start and end day of a week according to the year. I already formatted it using TOOLTIP.

Code: Select all

headerFormat: '<b>Semana: {point.key}</b><br>' + getWeek(anio, Highcharts.numberFormat(this.key, 0))
I need to pass POINT.KEY variable but it doesn't work in my GetDaysOfWeek (year, week) function.

How can I pass the value of the X axis that corresponds to the week number to my function?

When hovering over the bars with their respective weeks, the tooltip does not show the From Date and To Date correctly.

Test link: https://jsfiddle.net/ingezone/5goakdf3/116/

You see all calendar numbers in the year 2021
Image
mateusz.b
Posts: 2006
Joined: Tue Jul 13, 2021 11:34 am

Re: Formatting the Tooltip to display days of the week

HI ingezone,

Thanks for contacting us with your question.

In your case you should use tooltip.formatter and pass your callback function. It seems like the calculations don't work properly so you will probably have to adjust them but you can access point.key with this.points[0].key.
Demo:https://jsfiddle.net/BlackLabel/9y8xap3v/
API reference: https://api.highcharts.com/highcharts/tooltip.formatter

Let me know if you have any further questions!
Best regards!
Mateusz Bernacik
Highcharts Developer
ingezone
Posts: 28
Joined: Mon Feb 01, 2021 3:16 am

Re: Formatting the Tooltip to display days of the week

With a small adjustment according to your recommendation, it now works 100%.
Thank you :D
mateusz.b
Posts: 2006
Joined: Tue Jul 13, 2021 11:34 am

Re: Formatting the Tooltip to display days of the week

You're welcome! In case of any further questions, feel free to contact us again.
Mateusz Bernacik
Highcharts Developer

Return to “Highcharts Stock”