Datetime 如何在chartjs图表上显示我的自定义(日月年时:分:秒)时间格式?
我想在chartjs图表上显示我的自定义(日-月-年-小时:分钟:秒-->ex:01-05-2019 14:06:47 PM)时间格式Datetime 如何在chartjs图表上显示我的自定义(日月年时:分:秒)时间格式?,datetime,charts,chart.js,datetime-format,Datetime,Charts,Chart.js,Datetime Format,我想在chartjs图表上显示我的自定义(日-月-年-小时:分钟:秒-->ex:01-05-2019 14:06:47 PM)时间格式 如何在图表xAxis上显示这样的日期格式>> 日-月-年-小时:分钟:秒-->ex:01-05-2019 14:06:47下午 时间格式为timeFormat='DD/MM/YYYY h:MM:ss a',但图表上仅显示月、日、年 下面是我的代码: 上的在线代码>>> var timeFormat = 'DD/MM/YYYY h:mm:ss a';
如何在图表xAxis上显示这样的日期格式>>
日-月-年-小时:分钟:秒-->ex:01-05-2019 14:06:47下午
时间格式为
timeFormat='DD/MM/YYYY h:MM:ss a'
,但图表上仅显示月、日、年
下面是我的代码:上的在线代码>>>
var timeFormat = 'DD/MM/YYYY h:mm:ss a';
var config = {
type: 'line',
data: {
datasets: [
{
label: "UK Dates",
data: [{
x: "01-04-2014 02:15:50", y: 175
}, {
x: "12-04-2014 12:19:27", y: 177
}, {
x: "23-04-2014 22:25:47", y: 178
}, {
x: "28-04-2014 14:46:40", y: 182
}],
fill: false,
borderColor: 'blue'
}
]
},
options: {
responsive: true,
title: {
display: true,
text: "Chart.js Time Scale"
},
scales: {
xAxes: [{
type: "time",
time: {
format: timeFormat,
tooltipFormat: 'll'
},
scaleLabel: {
display: true,
labelString: 'Date'
}
}],
yAxes: [{
scaleLabel: {
display: true,
labelString: 'value'
}
}]
}
}
};
window.onload = function () {
var ctx = document.getElementById("canvas").getContext("2d");
window.myLine = new Chart(ctx, config);
};