Page 1 of 1

GANTT Scrollbar issue - remove numbers

Posted: Sun Oct 27, 2024 9:39 am
by soka
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

Re: GANTT Scrollbar issue - remove numbers

Posted: Mon Oct 28, 2024 10:54 am
by andrzej.b
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,