highcharts xaxis datetime标签与次要刻度

时间:2014-09-07 17:12:06

标签: datetime highcharts labels

我尝试使用日期时间x轴标签创建一个Highcharts图表,以1个月的间隔生成我的主要标签。然后我想在一周的时间间隔内使用minorTick。我的数据是每天1点。我面临的问题是我的minorTicks在图表上显示为网格线而不是子标记。我希望他们在外面,或者至少非常小。我怎样才能将这些次要刻度作为刻度,而不是网格线?我根本不需要任何网格线。

enter image description here

http://jsfiddle.net/590ktt7j/

$('#container').highcharts({

    yAxis: {
        gridLineWidth:0  
    },
    xAxis: {
        minorTickInterval: 7 * 24 * 3600 * 1000,
        minorTickPosition:'outside',
        minorTickLength:10,

        type:'datetime',
        min: Date.UTC(2014, 0, 1),
        max: Date.UTC(2014, 11, 31),
        labels: {
            step: 1,
        },
        dateTimeLabelFormats: {
            month: '%b',
            year: '%Y'
        }
    },

    // sample data, in reality goes 365 days of year
    series: [{
        data: [[1388984399000,100], [1388973600000,200],[1389060000000,300],[1389146400000,400],[1389232800000,500],[1389319200000,400],[1389405600000,200]]
    }]

});

1 个答案:

答案 0 :(得分:2)

网格线与刻度线无关。将这两个选项添加到xAxis配置:

xAxis: {
    minorTickWidth: 1, // this is by default 0 and is why you don't see ticks
    minorGridLineWidth: 0, // this disables the grid lines

修正了fiddle

相关问题