How to display vacations on gantt (collision handling)

Hi everyone,

I am currently using GPL version of Gantt.
Each task in my case displayed on the same line (render: split).

If a planning task belongs to me which starts 05.06.2019 duraton 5 days but the I am on vacation between 05.06.2019 and 10.06.2019.
There is a “collision” in this case I should have to display with different color in this case.

So, how can I display vacation dates on gantt to be able to handle collisions?
What would be the best solution?


Hi @cookiez!

If I understand you correctly you want just display collisions of the tasks and vacation dates on the timeline area.

There are various ways of how it might be implemented.

It can implement by using additional layers.
If you have vacation dates as a string type data modify it to the time object using method:

Use addTaskLayer() method to add custom elements for the task crossing the vacation dates:

Use valueOf() method from the public API to compare date values:

Here is a snippet how it can be implemented:

Alternatively you can do this using task_cell_class template.
Here is a related article:
Here is a related snippet:

Alternatively you can do this using task_class template.
Here is a related article:
Here is a related snippet:

You can also check the article and the sample about the working time:
Use setWorkTime() method to set the working time for the Gantt chart:
Use unsetWorkTime() method to unset vacation dates:

Does it resolve your issue? Please let me know if you need something different?

Hi @guldmi,

Thanks for your reply. Addtasklayer looks promising to me.
This solution is not working if I use projects (render:“partial”) only without any parent project.
I am trying to solve my problem using an additional json which stores the vacation data.

Lets say I have different type of tasks (meeting, planning, production, etc.). Their parent project render property is set to split.
I would like to show collisions for tasks (type:planning) but addtasklayer fires only projects.


Hello Cookiez,
Gantt uses the additional layer to display split tasks that’s why it doesn’t fire for the children of the split project task.
But you can use a variable to check if we should highlight the cells or not.
The first condition check remains the same:

var highlight_vacations = false;
 if ([i].designer === task.designer) highlight_vacations = true;

Then you check if the task is split and that it has children. When it is true, you check each child task for the same condition:

if (task.render == "split" && gantt.hasChild( gantt.eachTask(function(child){
        if ([i].designer === child.designer) highlight_vacations = true;

Here is the updated snippet:

However, have you checked the work time option? The additional layer allows you to highlight the vacation days and display it over tasks. But tasks remain at the same place. While the working time stretches the tasks excluding the weekends and vacation days from the duration.
Here is an example(try moving tasks to the highlighted days):


I solved my “issue” with the following. Additional task property is added to every task named subtype.

gantt.addTaskLayer(function draw_vacation(task) {
if (task.render !== “split”)
return false;

    var plantask = gantt.getTaskBy(tasks => tasks.subtype=== "plan" && tasks.parent ===;

    if (plantask.length === 1)
         //find if designer is on vacation and add the necessary layer

I tried Working time but did not find it usefull to me.

I have a small problem with column width on timeline. I would like to change the width of columns to as low as needed but it did not work.
gantt.config.subscales = [
{ unit: “day”, step: 1, date: “%d.” }

gantt.config.min_column_width = 10;

The lowest column width was 49px on every element but it is much more then I want.


Is there any solution to be able to change column width?


Hello Zoltan,
The min_column_width parameter changes the minimal width of the column in the timeline. It doesn’t change the column width of the “lowest” scale cell. So, when you get 49px for the column width, it works as expected because 49 is not less than 10, so Gantt doesn’t change the column width.
Gantt doesn’t have a property like gantt.config.min_column_min_width.
Instead, Gantt stretches the columns to fit all the available space.
So, if you want to change the width of the minimal scale, you need to increase the displayed date range: