hml_noria
Posts: 5
Joined: Thu Feb 23, 2023 10:10 am

Custom triggering of expand/collapse

Hi.

I am looking for a way to expand the boxes on the y-axis by clicking on the actual graph.
In this example, clicking on the blue bar expands Example 1, clicking on the green bar expands Example 2.

Image

I have not been able to find the event that runs when clicking on the the boxes in the y-axis, to trigger them from clicks on the graph.

Any help is appreciated :)

Thank you!
jedrzej.r
Posts: 742
Joined: Tue Jan 24, 2023 11:21 am

Re: Custom triggering of expand/collapse

Hi!

Thanks for reaching out to us with your question!

Of course, it is possible by utilizing the treeGrid collapse method into the point.click event on Gantt chart.

Demo: https://jsfiddle.net/BlackLabel/2h6wdev3/

References:
https://api.highcharts.com/gantt/series ... ents.click
https://github.com/highcharts/highchart ... #L442-L469

Let me know if that's what you were looking for.
Best regards!
Jędrzej Ruta
Highcharts Developer
hml_noria
Posts: 5
Joined: Thu Feb 23, 2023 10:10 am

Re: Custom triggering of expand/collapse

Hi again, and thanks for your quick reply.

I am using React with TypeScript, and the problem I have is that neiter .brokenAxis nor.treeGrid are available on my object tick.axis

My Axis object is of the type Highchart.Axis

Image

Do you have a solution that works with this setup?

Thanks again!
jedrzej.r
Posts: 742
Joined: Tue Jan 24, 2023 11:21 am

Re: Custom triggering of expand/collapse

Hi again!

You are correct, the broken-axis types aren't inherited into the Highcharts.Axis interface. In order to get rid of the error, you can extend this interface and provide safe typing like so:

Code: Select all

interface BrokenAxis extends Highcharts.Axis {
  // your types go here
}
Live demo: https://stackblitz.com/edit/react-start ... le=App.tsx

References: https://www.highcharts.com/docs/advance ... clarations

Let me know if that was helpful for you.
Best regards!
Jędrzej Ruta
Highcharts Developer

Return to “Highcharts Gantt”