soka
Posts: 4
Joined: Wed Oct 25, 2023 7:48 am

GANTT Scrollbar issue - remove numbers

Hello,
I make visualizations with the GANTT class.
When I want to show many lines in the y-axis, I create a scrollbar: {enabled: true,},
I always want to show the same number of lines, e.g. 30 lines and therefore I set the maximum: 30. But if there is only data to fill in fewer lines, a number appears in the field - see attachment.
Simple question - how do I remove that number so the field becomes empty?
Regards,
Soren
Attachments
Absent Tracker sample.png
Absent Tracker sample.png (68.86 KiB) Viewed 884 times
andrzej.b
Site Moderator
Posts: 336
Joined: Mon Jul 15, 2024 12:34 pm

Re: GANTT Scrollbar issue - remove numbers

Hi Soren,

Thanks for contacting us with your question!

When you set yAxis max to 30, by default it will display values up to 30, regardless if your data matches this max - hence the numbers appear.
You can use yAxis label formatter function to conditionally render the yAxis labels based on the length of your data set:

Code: Select all

  yAxis: {
    max: 30,
    labels: {
      formatter: function () {
        const totalDataPoints = this.axis.series[0].data.length
        return parseInt(this.value) >= totalDataPoints ? "" : this.value
      },
    },
  },
Please let me know if I can be of any further assistance.

Best regards,
Andrzej
Highcharts Developer

Return to “Highcharts Gantt”