Home › forums › Using CanvasJS › Format date in tooltip content
This topic contains 3 replies, has 2 voices, and was last updated by Anjali 3 years, 10 months ago.
I have my X axis as a date with time and would like to show the date and time in the tooltip content when a user hovers over my line graph. I see you can customize the tooltip content using this option https://canvasjs.com/docs/charts/chart-options/data/tooltipcontent/ , but I do not see how I can format the date display the time with it as well.
Please use xValueFormatString property of dataSeries.
Thanks, that is what I was looking for. When I first looked at the docs for that property, I thought that would have changed the label as well since it says “Defines how x axis values must be formatted before they appear on the indexLabel or toolTip,” but looking at the sample on the page it doesn’t change the indexLabel. Is that right?
Format string for labels on axisX are defined by valueFormatString property of axisX and xValueFormatString controls formatting of x values outside the axis.
I thought that would have changed the label as well since it says “Defines how x axis values must be formatted before they appear on the indexLabel or toolTip.
That was a typo and we have fixed the same. Thanks for reporting.
You must be logged in to reply to this topic.