简体   繁体   中英

How to change format of the upper xAxis Label?

How can I change the format of the "upper" xAxis Label as shown in the picture? 上 xAxis 标签

I have already figured out how to change the weekday labels below (T, W, T, etc.) with the following snippet (for weeks, code placed within the xAxis):

dateTimeLabelFormats: {
    week: {
        list: ['Kalenderwoche %W', 'KW%W']
    }
},

Existing example to play around: https://jsfiddle.net/gh/get/library/pure/highcharts/highcharts/tree/master/samples/gantt/demo/resource-management

You have 2 xAxis. So you should provide dateTimeLabelFormats array.

axis with the lower index will be placed lower.

So, your xAxis should be

  xAxis: [{
      currentDateIndicator: true,
      dateTimeLabelFormats: {
        day: {
          list: ['%A, %e. %B', '%a, %e. %b', '%E']
        }
      }
    },
    {
      dateTimeLabelFormats: {
        week: {
          list: ['Kalenderwoche %W', 'KW%W']
        },
        month: {
          list: ['Monat%W', 'KW%W']
        }
      }
    }
  ],

According to this page , the way to do it is to set the x-axis to be an array of objects, with each representing a level of the x-axis (day, week, month, etc.). In this case: https://jsfiddle.net/vm5t78j3/

    xAxis: [{
        currentDateIndicator: true,
    }, {
      labels: {
        format: '{value:%W}'
      },
    }],

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM