I need to set max-height of Gantt container. So, if Gantt chart doesn’t have any items, div will not occupy any place, but if it has too much items, scrollbar is appeared inside it. How to implement this behaviour, I see that all samples are using fixed height?

I’m using code like this:

[code] $.get(dataUrl, function(data) {
if (!data.length) {


        var containerHeight = ganttInstance.config.scale_height + ganttInstance.config.row_height * data.length;

        $element.css('height', $element.css('min-height'));
        var height = $element.innerHeight();

        $element.css('height', $element.css('max-height'));
        if ($element.innerHeight() > height) {
            height = $element.innerHeight();

        if (containerHeight < height) {
            height = containerHeight;

        ganttInstance.parse({data: data});

there is no built-in option that does exactly what you need, but you can alter gantt sizing options dynamically
Please check this example: