Shashi Deshetti
Shashi Deshetti

Reputation: 1404

Tooltip in Highcharts doesn't show the right format for Date

The tooltip in Highcharts shows the date as a long number.

enter image description here

Here is the link to the code: http://jsfiddle.net/np3tL24h/1/

I had the same issue with x-axis label showing these weird numbers instead of date and I used the formatter to format in the right way

"format": "{value: %b '%y}"

I tried to do the same for the tooltip as well, but it is not working. I see from the highchart documentation to use xDateFormat for formatting the dates in tooltip. Here is an example from Highcharts where it is working as expected: http://jsfiddle.net/gh/get/library/pure/highcharts/highcharts/tree/master/samples/highcharts/tooltip/xdateformat/

I tried to do the same in my code as well, but it is not formatting the right way. I am using the following in my code:

"tooltip": {"valueSuffix": "", "xDateFormat": "%b '%y"}

Any help is greatly appreciated.

Thanks

Upvotes: 0

Views: 545

Answers (1)

João Menighin
João Menighin

Reputation: 3225

You should use headerFormat like:

tooltip: {
    shared: true, 
    headerFormat: '{point.key:%b\'%y}<br/>'
}

Here's a working fiddle: http://jsfiddle.net/zysm24ty/

Upvotes: 2

Related Questions