The described functionality is deprecated since version 6.2. Use the scales config to set any number of time scales. Check the details.
To present tasks in different time units, simultaneously, you can add any number of additional scales underneath the default one.
The second scales are defined with the subscales property:
gantt.config.scale_unit = "month";
gantt.config.date_scale = "%F, %Y";
gantt.config.subscales = [
{unit:"week", step:1, date:"%W"},
{unit:"day", step:1, date:"%D" }
];
You can configure the following aspects of a second scale:
To set the unit of the second scale, use the unit attribute of the subscales property:
gantt.config.subscales = [
{unit:"month", date:"%F, %Y" }
];
Related sample: Multiple scales
To set the step of the second scale, use the step attribute of the subscales property:
gantt.config.subscales = [
{unit:"month", step:1, date:"%F, %Y" }
];
Related sample: Multiple scales
To set the format of the second scale, use:
gantt.config.subscales = [
{unit:"week", step:1, date:"%W"}
];
gantt.config.subscales = [
{unit:"week", step:1, template:weekScaleTemplate}
];
var weekScaleTemplate = function(date){
var dateToStr = gantt.date.date_to_str("%d %M");
var endDate = gantt.date.add(gantt.date.add(date, 1, "week"), -1, "day");
return dateToStr(date) + " - " + dateToStr(endDate);
};
Related sample: Multiple scales
See the Date Format Specification article to know about available format characters
To style the second scale, use the css attribute of the subscales property:
<style type="text/css">.weekend{
background: #F0DFE5 !important;
}
</style>
var daysStyle = function(date){
var dateToStr = gantt.date.date_to_str("%D");
if (dateToStr(date) == "Sun"||dateToStr(date) == "Sat") return "weekend";
return "";
};
gantt.config.subscales = [
{unit:"day", date:"%D", css:daysStyle }
];
Use the !important keyword with CSS properties to guarantee that they will be correctly applied.
Related sample: Multiple scales
Back to top