I have 600 resources and 10 years of calendar data. In the Gantt, I am creating calendars for each resource. But each calendar will take ~2s to create and I have many resources. Is there any faster way for this one? The calendar for each resource is unique and it is set per day. Maybe there is a way to initialize in the addcalendar the array of days?
resourceWorkTimeData.forEach((resourceWorkTime) => {
const calendarId = gantt.addCalendar({ id: resourceWorkTime.resourceId });
const calendar = gantt.getCalendar(calendarId);
//Set the default work time for all days to non-working day
for (let day = 0; day < 7; day++) {
calendar.setWorkTime({ day, hours: [GANTT_NONWORKING] });
}
resourceWorkTime.workTime.forEach((workTime) => {
const workHours = workTime.shiftHours;
const date = new Date(workTime.year, workTime.month - 1, workTime.day);
if (workHours && workHours.length > 0) {
calendar.setWorkTime({ date: date, hours: workHours });
}
});
});