簡體   English   中英

如何在 x 軸上顯示月份和年份,並在 Highcharts 中顯示為數字?

[英]How can I have month and year in x axis, display as number in Highcharts?

現在在我的高圖中,我有 x 軸顯示日期。 顯示的日期格式如下

30 Nov 2019 10:00

我的 x 軸設置

          xAxis:{
            type:'datetime',
            title:
            {
              align:'high'
            }, 
            labels: {
              padding: 50,
              format: '{value:%e %b %Y %H:%M}',
              style: {
                fontSize: '10px'
              }
            }
          }, 

我怎么能這樣顯示日期

30 11 19 10:00

謝謝

您可以使用文檔中顯示的格式: https : //api.highcharts.com/class-reference/Highcharts#.dateFormat

      xAxis:{
        type:'datetime',
        title:
        {
          align:'high'
        }, 
        labels: {
          padding: 50,
          format: '{value:%d %m %y %H:%M}',
          style: {
            fontSize: '10px'
          }
        }
      }, 

更一般地說,這些格式在許多編程語言中被廣泛使用,參考是PHP 的 strftime 實現

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM