werwerwer1
Posts: 3
Joined: Wed Mar 15, 2023 9:07 pm

How to change the format of the date popup label on stock chart near X axis?

Hello. I cannot find any information about the little popup date tooltip thing that you see on the highcharts stock chart when you mouse over the chart. Screenshot attached. That label near the x axis, how do I change the format?

Thanks.
Attachments
unnamed.jpg
unnamed.jpg (77.92 KiB) Viewed 471 times
jakub.s
Posts: 1164
Joined: Fri Dec 16, 2022 11:45 am

Re: How to change the format of the date popup label on stock chart near X axis?

Hi,

Welcome to our forum & thanks for the question!

In the attached image you've circled the tooltip header. You can use either tooltip.headerFormat or tooltip.formatter to affect what's inside.

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

API:
- https://api.highcharts.com/highstock/tooltip.formatter
- https://api.highcharts.com/highstock/to ... aderFormat

Let me know if you encounter any problems.

Best regards,
Jakub
Jakub
Highcharts Developer
werwerwer1
Posts: 3
Joined: Wed Mar 15, 2023 9:07 pm

Re: How to change the format of the date popup label on stock chart near X axis?

Okay but how do I change JUST the tool tip header? I don't want to mess with the label formatting, yet I don't see any way to just customize the header. I want to change how it shows the date. I need to put some logic into it so I need a custom function.
jakub.s
Posts: 1164
Joined: Fri Dec 16, 2022 11:45 am

Re: How to change the format of the date popup label on stock chart near X axis?

Sure, I understand.

If it's something simple, you can use headerFormat. If you need to use a custom function with additional logic, you could just extend the tooltip.defaultFormatter.

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

Let me know if that's what you were looking for.

Regards,
Jakub
Jakub
Highcharts Developer
werwerwer1
Posts: 3
Joined: Wed Mar 15, 2023 9:07 pm

Re: How to change the format of the date popup label on stock chart near X axis?

Thanks, yes that's what I needed. The documentation is not clear in regards to how this formatting function works.
jakub.s
Posts: 1164
Joined: Fri Dec 16, 2022 11:45 am

Re: How to change the format of the date popup label on stock chart near X axis?

I'm glad it works for you:)

In case the documentation is not clear enough do not hesitate to ask any question on this forum!

We'll be happy to help!

Regards,
Jakub
Jakub
Highcharts Developer

Return to “Highcharts Stock”