我具有所附的highchart,时间戳显示为从DB收到。我需要某种方式将其转换为人类可读但没有成功的方法。 highchart
xAxis: {
type: 'datetime',
categories: labels,
formatter: function () {
return "mydate: " + moment.utc(moment.unix(this.x/1000)).format("DD/MM-YYYY HH:mm:ss") + "<br> myspeed: " + this.y;
}
}
答案 0 :(得分:0)
labels
选项必须嵌套在xAxis
中,而不是嵌套在xAxis: {
type: 'datetime',
categories: labels,
labels: {
formatter: function () {
return "mydate: " + moment.utc(moment.unix(this.x/1000)).format("DD/MM-YYYY HH:mm:ss") + "<br> myspeed: " + this.y;
}
}
}
中:https://api.highcharts.com/highcharts/xAxis.labels.formatter
{{1}}