0

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

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

Fabian Bigler
  • 10,403
  • 6
  • 47
  • 70

2 Answers2

1

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']
        }
      }
    }
  ],
robdev91
  • 1,006
  • 1
  • 10
  • 18
1

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}'
      },
    }],
sbgib
  • 5,580
  • 3
  • 19
  • 26