问题
I am using the chart.js to generate a chart. All works fine !
But how can I format the tooltip information? It should be: 28.04.2020 - 05:00
回答1:
You need to define time.tooltipFormat for your xAxis
.
See Moment.js for the allowed format tokens.
options: {
...
scales: {
xAxes: [{
type: 'time',
time: {
unit: 'hour',
tooltipFormat: 'DD.MM.YYYY - HH:mm'
}
...
}]
}
...
}
来源:https://stackoverflow.com/questions/61474243/change-date-format-in-tooltip-of-chart-js