[email protected]
Posts: 65
Joined: Fri Aug 26, 2022 9:33 am

xAxis how to present month day instead week day?

Hello,
How I can present day of month instead week day in xAxis?

I have the follow code:

xAxis:
[{ // first x-axis
min: $parameters.StartDate.getTime(),
max: $parameters.EndDate.getTime() + (5 * day),
tickInterval: 1000 * 60 * 60 * 24 // 1 month
}, { // second x-axis
tickInterval: 1000 * 60 * 60 * 24 * 7 // 1 week
}, { // third x-axis
tickInterval: 1000 * 60 * 60 * 24 * 30, // 1 day
}],

Thanks in advance, Paulo Torres
hubert.k
Posts: 1164
Joined: Mon Apr 11, 2022 11:48 am

Re: xAxis how to present month day instead week day?

Hello Paulo!
Thanks for contacting us with your question!

You can set your xAxis label dates by using e.g. dateTimeLabelFormats, thanks to that, you can control every unit of dates dynamically and set it to your preferences.

Demo: https://jsfiddle.net/BlackLabel/zbro38f0/
API Reference: https://api.highcharts.com/gantt/xAxis. ... belFormats
https://api.highcharts.com/class-refere ... dateFormat

Let me know if that was what you were looking for.
Regards!
Hubert Kozik
Highcharts Developer
[email protected]
Posts: 65
Joined: Fri Aug 26, 2022 9:33 am

Re: xAxis how to present month day instead week day?

hubert.k wrote: Thu Sep 01, 2022 7:13 am Hello Paulo!
Thanks for contacting us with your question!

You can set your xAxis label dates by using e.g. dateTimeLabelFormats, thanks to that, you can control every unit of dates dynamically and set it to your preferences.

Demo: https://jsfiddle.net/BlackLabel/zbro38f0/
API Reference: https://api.highcharts.com/gantt/xAxis. ... belFormats
https://api.highcharts.com/class-refere ... dateFormat

Let me know if that was what you were looking for.
Regards!

Thanks hubert.
I can't do what I want.

It's possible in 3 line of xAxis instead to day of week (M, T, W...) having day of month (1, 2, 3...) ?

You can check here what I have: https://postimg.cc/jwMZ4twK

Thanks in advance, Paulo Torres
hubert.k
Posts: 1164
Joined: Mon Apr 11, 2022 11:48 am

Re: xAxis how to present month day instead week day?

Paulo,
You can achieve it by using mentioned xAxis.dateTimeLabelFormats and xAxis.labels.formatter function to change them a little bit.

Demo: https://jsfiddle.net/BlackLabel/tdjnp27g/
API Reference: https://api.highcharts.com/gantt/xAxis.labels.formatter

Regards!
Hubert Kozik
Highcharts Developer

Return to “Highcharts Gantt”