【问题标题】:show custom date on xAxis in highstock lineseries在 highstock lineseries 中的 xAxis 上显示自定义日期
【发布时间】:2017-01-09 06:00:44
【问题描述】:

我有从 2 月到 12 月每个月的月末数据。在 xAxis 上,我想显示日期和月份,例如 29.feb、31.dec 等。我使用了刻度间隔和 datetimelabelformats,如下所示:

        xAxis : {
                    type: 'datetime',
                    tickInterval: 3600*1000,//time in milliseconds
                    datetimelabelformats:{
                        day: '%e. %b',
                        month: '%b \'%y',
                        year: '%y'
                    }
                },

它的显示日期如 21.mar,25.Apr 但我无法显示月底日期如 31.mar。谁能帮忙? 这是fiddle

【问题讨论】:

    标签: jquery highstock


    【解决方案1】:

    迟到了,不过我觉得你需要用labels之类的,

    xAxis:{
        labels: {
            formatter: function() {
              return Highcharts.dateFormat('%e. %b', this.value - 
                        3600000 //needed otherwise it will start from 1 date of month
                     );
            }
        },
        ...
    }
    

    Fiddle

    【讨论】:

      猜你喜欢
      • 2016-03-19
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-04-18
      • 1970-01-01
      • 2015-06-19
      • 1970-01-01
      相关资源
      最近更新 更多