Our state of the art Gantt chart


Post by prem.k@zetwerk.com »

Hi Team,
Below is my calendar configuration where Sunday is non working day. But when i click on showCritical path action it considering Sunday as working day as well.So if Sunday comes in between tasks, critical path is not showing because of Sunday gap.

calendar : 9999,
    // we use an 8hrs calendar for the project
    // then duration unit values should match the calendar:
    hoursPerDay  : 24, // 1 day === 8 hrs
    daysPerWeek  : 6, // 1 week === 6 days
    // calendars data
    calendarsData : [
        {
            id        : 9999,
            name      : 'My calendar',
            intervals : [
              {
                  recurrentStartDate : "on Sat at 0:00",
                  recurrentEndDate   : "on Sun at 0:00",
                  isWorking          : false
              }
          ]
        }
    ]

Please find the attached image below.

Screenshot 2021-09-23 at 11.54.55 AM.png
Screenshot 2021-09-23 at 11.54.55 AM.png (1.31 MiB) Viewed 493 times

If you see rectangle block all dependent task should get highlighted but it shows only last one. Please have a look.


Post by arcady »

Without a test case I can only guess. I see gaps between the tasks which probably break the critical path.


Post by prem.k@zetwerk.com »

In our system we have decided to keep both start and end dates included in the duration and the subsequent item starts at previous items end date + 1 (In screenshot, 3.2.2 ends on 30th Sep and 3.2.3 starts on 1st Oct), which seems like a gap on the gantt. How do we still show it as part of the critical path with this use case?


Post by arcady »

It is a gap. Your 3.2.2 task ends 30th Sep at 00:00:00 and 3.2.3 starts on 1st Oct at 00:00:00. There are 24 hrs of working time between them.

Critical paths are built based on https://www.bryntum.com/docs/gantt/#Gantt/model/TaskModel#field-totalSlack value which in turn uses https://www.bryntum.com/docs/gantt/#Gantt/model/TaskModel#field-earlyStartDate, https://www.bryntum.com/docs/gantt/#Gantt/model/TaskModel#field-lateStartDate https://www.bryntum.com/docs/gantt/#Gantt/model/TaskModel#field-earlyEndDate and https://www.bryntum.com/docs/gantt/#Gantt/model/TaskModel#field-lateEndDate values.
These early date values are used not for critical paths only but as automatically scheduled task start/end dates.
So if you want the critical paths to behave differently you need to change the logic all these fields are calculated.


Post by prem.k@zetwerk.com »

Hi Arcady,

It would be great if you can share some sample code how can we override critical path logic.


Post by arcady »

Check ConstrainedLateEventMixin class code. There we have totalSlack calculation done in calculateTotalSlack method. So you need to override that method. But as I said you will have to override calculation of the other fields too.

In our system we have decided to keep both start and end dates included in the duration

Have you tried simply using 8hrs/day calendar?
You can try that on the advanced demo (even online here). Just execute this code in your browser console and then try editing tasks:

gantt.project.hoursPerDay = 8
gantt.project.calendar = 'business'

If doing that shows dates the way you expect it will be much easier than overriding critical paths with a half of the Gantt logic..


Post by prem.k@zetwerk.com »

And what if i can send the totalSlack value from backEnd will it work?


Post by arcady »

Yes if you override the calculateTotalSlack to use that value as-is.
Something like this:

export default class MyTask extends TaskModel {
    * calculateTotalSlack() {
        return yield ProposedOrPrevious;
    }

PS if you use our bundles please use the Gantt version >= 4.2.5 since ProposedOrPrevious was exposed there since that version only.


Post by prem.k@zetwerk.com »

Hi Arcady,
I am using bryntum 4.2.5 but when i am calling

* calculateTotalSlack() {
        return yield ProposedOrPrevious;
    }

It's not getting called?


Post by arcady »

Please provide a test case otherwise we can only guess what happens.


Post Reply