I wont to display tooltip in scale area.
if scale is “month” and gantt displays Jul 2022 , then tooltip should be “1/7/2022 - 31/7/2022”. like wise i want to display tool tips for Year , month ,week and day scales.
const tooltips = gantt.ext.tooltips;
tooltips.tooltipFor({
selector: ".gantt_scale_line:nth-child(2)",
html: function (event, domElement) {
const domHelper = gantt.utils.dom;
const dateToStr = gantt.date.date_to_str("%d/%m/%Y");
let pos = domHelper.getRelativeEventPosition(event, gantt.$task_scale);
let firstDay = gantt.date.month_start(gantt.dateFromPos(pos.x));
let lastDay = new Date(firstDay.getFullYear(), firstDay.getMonth() + 1, 0);
return `${dateToStr(firstDay)} - ${dateToStr(lastDay)}`;
}
});
Please check the following snippet: https://snippet.dhtmlx.com/a29qa7dh ;
To create a tooltip for links, you need to get the ID of the link. One of the options is to get it from the attribute of the DOM element:
tooltips.tooltipFor({
selector: ".gantt_task_link",
html: function (event, domElement) {
let linkId = domElement.getAttribute(gantt.config.link_attribute);
if (linkId) {
... your tooltip's template
}
}
});