在highstock lineseries中显示xAxis上的自定义日期

时间:2017-01-09 06:00:44

标签: jquery highstock

我有从2月到12月的每个月的月末数据。在xAxis上,我想用29.feb,31.dec等显示月份,我使用了tick间隔和datetimelabelformats,如下所示:

        xAxis : {
                    type: 'datetime',
                    tickInterval: 3600*1000,//time in milliseconds
                    datetimelabelformats:{
                        day: '%e. %b',
                        month: '%b \'%y',
                        year: '%y'
                    }
                },

它的显示日期类似于21.mar,25.Apr,但我无法像31.mar一样显示月末日期。有人可以帮忙吗? 这是fiddle

1 个答案:

答案 0 :(得分:1)

迟到了,但我认为你需要使用labels之类的,

xAxis:{
    labels: {
        formatter: function() {
          return Highcharts.dateFormat('%e. %b', this.value - 
                    3600000 //needed otherwise it will start from 1 date of month
                 );
        }
    },
    ...
}

<强> Fiddle