Highcharts日期在xaxis定制

时间:2014-09-22 09:12:02

标签: javascript jquery highcharts

我们如何将日期格式化为此格式

enter image description here

现在就是这样:

enter image description here

xAxis: {
            type: 'datetime'
        }

JS Fiddle here

1 个答案:

答案 0 :(得分:1)

我刚刚更改了xAxis的代码

这是:

xAxis: [{
            type: 'datetime',
            labels: {
            formatter: function() {

                return Highcharts.dateFormat('%e', this.value);

            }
        },

        tickInterval: 1 * 24 * 3600 * 1000
        },
        {   lineWidth: 0,
           minorGridLineWidth: 0,
           lineColor: 'transparent',
           minorTickLength: 0,
           tickLength: 0,
            type: 'datetime',
            labels: {
            formatter: function() {
                return Highcharts.dateFormat('%b', this.value);

            }
        },

        tickInterval: 30 *24 * 3600 * 1000
        }]

有关详情,请参阅此jsFiddle链接http://jsfiddle.net/3nLmxs89/1/