Can I toggle the histogram?

I have a gantt chart with a histogram. I’m trying to find a way to toggle the display of histogram on and off the page. I don’t see any examples of this, how can it be achieved?

So the only way I found was to change the layout = …myLayout. Is there another way to handle this?

Hello,
The only way to toggle the histogram view is to switch between layout configurations. And you need to reinitialize Gantt to apply the changes.
Here is the snippet:
http://snippet.dhtmlx.com/8b2e8879f

If you don’t want to have different layout configurations, you can modify the existing one:
http://snippet.dhtmlx.com/e5900a02f

Thank you, the toggle is perfect!

If I reinit the gantt to apply the changes. SHould I reinit all the events as well? I noticed addTaskLayer doesn’t fire anymore if I take the first approach.

Hello,
You don’t need to detach all events and attach them again.
But you need to recreate the additional layer after Gantt is reinitialized:
https://docs.dhtmlx.com/gantt/api__gantt_addtasklayer.html
Here is an example of how it works:
https://snippet.dhtmlx.com/8d4cf916d