Posts: 7
Joined: Tue Jan 31, 2023 8:18 pm

Customize xAxis labels in Gantt chart

Tue Jan 31, 2023 8:35 pm


Is it possible to customise (set) xAxis labels to be same interval and width, for example, the label string to be incremented by 2.5 min each. Here is design example for it. How is it possible to achieve this?
Screenshot 2023-01-31 at 21.28.22.png
Screenshot 2023-01-31 at 21.28.22.png (23.85 KiB) Viewed 614 times

Posts: 1068
Joined: Thu Aug 12, 2021 12:04 pm

Re: Customize xAxis labels in Gantt chart

Thu Feb 02, 2023 11:44 am

Hi, welcome to our forum!

You need to set xAxis.units property in combination with xAxis.tickInterval to set such an interval. And to set this formatting for labels you need to use xAxis.labels.formatter() callback function.

Demo: https://jsfiddle.net/BlackLabel/jh6bm7yz/
API: https://api.highcharts.com/highcharts/xAxis.units
https://api.highcharts.com/highcharts/x ... ckInterval
https://api.highcharts.com/highcharts/x ... .formatter

Best regards!
Michał Filipiec
Highcharts Developer

Return to “Highcharts Gantt”