我有附加的高图,时间戳显示为从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;
}
}
formatter
选项必须嵌套在labels
中,而不是嵌套在xAxis
中:https://api.highcharts.com/highcharts/xAxis.labels.formatter
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;
}
}
}