如何格式化xAxis timedata,如图所示。 我试过的是:
xAxis: {
allowDecimals: false,
type: "datetime",
categories: [Date.UTC(2013, 0, 7),Date.UTC(2013, 0, 9),Date.UTC(2014, 0, 3),Date.UTC(2015, 0, 5),Date.UTC(2016, 0, 7)],
labels: {
//format: '{value: %A, </b> %y </b> %B}',
formatter: function () {
var dayStr = Highcharts.dateFormat('%A', this.value);
var monthstr = Highcharts.dateFormat('%B', this.value);
var yearstr = Highcharts.dateFormat('%y', this.value);
var finaldate = '<div>' + dayStr + '</div></br><div>' + yearstr + monthstr + '</div>'
return finaldate; // clean, unformatted number for year
}
}
},
提前感谢!!
答案 0 :(得分:1)
我通过添加useHTML
useHTML: true,
//format: '{value: %A, </b> %y </b> %B}',
formatter: function () {
var dayStr = Highcharts.dateFormat('%A', this.value);
var monthstr = Highcharts.dateFormat('%B', this.value);
var yearstr = Highcharts.dateFormat('%y', this.value);
var finaldate = '<div>' + dayStr + '</div><div>' + yearstr + ' ' + monthstr + '</div>'
return finaldate; // clean, unformatted number for year
}