Highcharts - Xaxis应该只显示几天和几个月,隐藏毫秒

时间:2014-03-12 16:18:51

标签: javascript highcharts

我的xAxis折线图如下:

xAxis: {
            type: 'datetime',
            dateTimeLabelFormats: {
              minTickInterval: 24 * 3600 * 1000,
              day: '%e %b'
            },
            title: {
                text: null
            }
        },
        yAxis: {
            title: {
                text: null
            },
            labels: {
                formatter: function() {
                    return this.value;;
                }
            }
        },
        tooltip: {
            formatter: function() {
                    return '<b>'+ this.y +' '+
                    'at ' + Highcharts.dateFormat('%e %B', this.x);
            }
        }

它在工具提示中显示正确的日期格式 - “3月4日的232”。但是XAXIS - 11:03:00.000

如何只显示日期和月份?

1 个答案:

答案 0 :(得分:1)

你应该设置毫秒,而不是白天。

dateTimeLabelFormats: {
              minTickInterval: 24 * 3600 * 1000,
              millisecond: '%b %e'
},

http://jsfiddle.net/BlackLabel/van5h/4/