【问题标题】:highcharts xaxis datetime label with minor tickhighcharts xaxis 日期时间标签,带有小刻度
【发布时间】:2014-09-07 17:12:05
【问题描述】:

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

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]]
    }]

});

【问题讨论】:

    标签: datetime highcharts labels


    【解决方案1】:

    网格线独立于刻度线。将这 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。

    【讨论】:

      猜你喜欢
      • 2017-12-11
      • 1970-01-01
      • 1970-01-01
      • 2018-05-02
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多