Ines2106
Posts: 5
Joined: Fri Jan 22, 2021 12:24 pm

Custom xAxis Labels for Highcharts

Tue May 04, 2021 4:32 pm

Hello everyone,

Thank you for the amazing assistance. I would like to create the following Gantt chart but instead of 2021, 2022, 2023. I would like to have Year 1, Year 2, Year 3.

Is it possible to do it. This is my project https://jsfiddle.net/t9qLxyde/1/. I have tried formatter but with no success

User avatar
sebastian.h
Posts: 1098
Joined: Fri Aug 07, 2020 7:08 am

Re: Custom xAxis Labels for Highcharts

Wed May 05, 2021 10:40 am

Hi,
Thanks for contacting us.

It's possible to add custom value in the label on the xaxis, you need to get to the function in xAxis.labels.formatter().

Code: Select all

    labels: {
      formatter() {
        return ' year'
      }
    },

Demo:
https://jsfiddle.net/BlackLabel/xLhg80u1/

API References:
https://api.highcharts.com/gantt/xAxis.labels.formatter

Let me know if was that what you were looking for.
Best regards.
Sebastian Hajdus
Highcharts Developer

Return to “Highcharts Gantt”