如何在xAxis中隐藏'小时'

时间:2013-08-26 15:46:22

标签: highcharts

我的xAxis折线图如下:

                            'xAxis' : {
                          'type' : 'datetime',
                          'labels' : {
                            'rotation' : -90,
                            'align' : 'right',
                            'y' : 1
                          },
                          'dateTimeLabelFormats' : {
                            'day' : '%e-%b',
                            'week' : '%e-%b',
                            'month' : '%b-%y'
                          }
                        }

但它不仅显示日/月,还显示小时数。有没有办法在这里隐藏时间? enter image description here

3 个答案:

答案 0 :(得分:1)

我认为您应该考虑minTickInterval将其设置为一天 - 否则Highcharts将计算间隔,并将其设置为例如半天(就像您的情况一样)。如果没有12:00标签,那么您将收到加倍的标签。当然,其他答案将解决显示12:00的问题,但不会阻止显示额外的标签。

参考:http://api.highcharts.com/highcharts#xAxis.minTickInterval

答案 1 :(得分:0)

您想要它采用什么格式?你可以通过做这样的事情把它放在'月'的'日'格式中。

xAxis: {
        type: 'datetime',
        dateTimeLabelFormats: {
            day: '%e of %b'
        }
    },

答案 2 :(得分:0)

您可以使用标签formatterhighcharts.dateFormat