Hello. Is it possible to put a separate configuration for the timescale in the resource timeline. It should be not the same with the task timeline. For example the task timeline has zoom levels year, month, day while the resource timeline has zoom levels year, month, day also but they have different configuration for each zoom level. I want to show different units for the task and resource timeline for each zoom level. Is this possible?
Hello Cairo,
Unfortunately, there is no built-in way to set different labels for the resource panel.
However, it should be possible to implement that.
In the format
function of the scale configuration, you can return any text or HTML elements:
https://docs.dhtmlx.com/gantt/api__gantt_scales_config.html#:~:text=format%3F%20(date)%3A%20any%20-%20(string%20|%20Function)%20--,the%20format%20of%20the%20scale's%20labels.%20If%20set%20as%20a%20function%2C%20expects%20a%20date%20object%20as%20a%20parameter.,-date%20-%20(Date)%20-%20a%20date%20that%20will
This means you can return both labels - for the main timeline and the resource timeline. Then you can hide the labels by using the style rules:
// JS:
{
unit: "day", step: 1, format: function (date) {
return `<div class="main_cell">${gantt.date.date_to_str("%d %M")(date)}</div><div class="resource_cell">${gantt.date.date_to_str("%d")(date)}</div>`
}
}
// CSS:
.timeline_cell .resource_cell,
.resourceTimeline_cell .main_cell{
display: none;
}
Here is the snippet: