本文介绍了在chart.js的工具提示中更改日期格式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用chart.js生成图表.一切正常!
I am using the chart.js to generate a chart.All works fine !
但是如何格式化工具提示信息?应该是:2020年4月28日-05:00
But how can I format the tooltip information? It should be: 28.04.2020 - 05:00
推荐答案
您需要定义 xAxis
的 time.tooltipFormat
.
You need to define time.tooltipFormat
for your xAxis
.
options: {
...
scales: {
xAxes: [{
type: 'time',
time: {
unit: 'hour',
tooltipFormat: 'DD.MM.YYYY - HH:mm'
}
...
}]
}
...
}
这篇关于在chart.js的工具提示中更改日期格式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!