Available only in **PRO Edition**

This functionality is available only in PRO edition

The library provides the possibility to hide unnecessary time units in the time scale of the chart. You can use this possibility, for example, to display only working days and hide weekends.

Generally, to hide a time unit in the time scale you need to use the **ignore_time** method.
The method is a function that takes the cell's date as a parameter. To hide a unit - return *true* for it.

For example, to hide weekends from the scale, use the method as in:

// 0 refers to Sunday, 6 - to Saturday
gantt.ignore_time = function(date){
if(date.getDay() == 0 || date.getDay() == 6)
return true;
};

Related sample: Not render weekends on the scale

Note, hiding time units from the scale doesn't exclude these units from calculation of the tasks duration. To exclude hidden units from duration's calculation, use the technique described in the article Work Time Calculation

Note that while using work time calculations, you can use isWorkTime instead of hardcoded values:

gantt.ignore_time = function(date){
if(!gantt.isWorkTime(date))
return true;
};

Related sample: Calculate working hours

Please note that the **ignore_time** method doesn't modify the scale. Let's consider the examples below which describe hiding of cells that don't have any working hours/days.

Example 1

A day scale starts at 00:00 and ends at 23:59, the working hours start at 08:00 and end at 16:59. You have a minimal scale in hours.
When the **ignore_time** method is applied, the cells that have non-working time, will be hidden for all the scales.
Thus, the day scale will start at 08:00 and end at 16:59. However, if you have just a day scale, it won't be changed.
It will start at 00:00 and end at 23:59, since there are working hours inside a day.

Example 2

A week scale has 7 days, 2 of which are days off (e.g. Saturday and Sunday). You have a minimal scale in days. When the **ignore_time** method is applied, the days off
are hidden and the week scale is rendered from Monday to Friday. However, if you have just a week scale the week will start on Monday and end on Sunday,
since there are days off in a week.

There are two ways to render a chart with hidden time units:

- to add a scale with lesser units (an hour scale for a day scale, a day scale for a week scale, etc.)
- to add a custom scale that will render just the working hours/days

Related sample: 5-day work weeks on the scale

Back to top