Our state of the art Gantt chart


Post by rayudu.pasumarthy »

Hi,

This scenario is quite similar to a previous post (viewtopic.php?f=52&t=17319&p=85951&hilit=syncdataonload#p85951)
When changing a task's duration to 1 and increasing it's start date by 17 days (25 if weekends are considered). The task duration does not reflect correctly in the Gantt.

As an example, please place the below code in gantt advanced example: (https://bryntum.com/examples/gantt/advanced/)

import { Toolbar, CalendarModel, Toast, DateHelper, CSSHelper, Column, ColumnStore, TaskModel, Gantt } from '../../build/gantt.module.js?449764';
import shared from '../_shared/shared.module.js?449764';

const gantt = new Gantt({
    appendTo : 'container',

project : {
    eventStore : {
        syncDataOnLoad : true
    },

repopulateOnDataset : false,

eventsData : [
{
"id": "79d9b2d5-82bc-4e82-9e9f-a030d0463e27",
"name": "Email Notifications & Auto-updates",
"startDate": "2021-02-26T00:00:00",
"endDate": "2021-03-22T23:59:59",
"taskDuration": 17,
"expanded": true,
"manuallyScheduled": true,
"children": [
  {
    "id": "9e09ccc8-f6c8-4fc6-a92d-c7d82587bae4",
    "name": "Daily Task Update Reminder",
    "startDate": "2021-02-26T00:00:00",
    "endDate": "2021-03-22T23:59:59",
    "taskDuration": 17,
    "manuallyScheduled": true,
  },
  {
    "id": "05b35d05-21b9-4a06-8898-d9b7f8efcca4",
    "name": "New Task Assigned to You",
    "startDate": "2021-03-01T00:00:00",
    "endDate": "2021-03-01T23:59:59",
    "taskDuration": 1,
    "manuallyScheduled": true,
  },
  {
    "id": "6f02b615-638d-4643-be59-78b0e7b787b9",
    "name": "New Actionable Task",
    "startDate": "2021-03-02T00:00:00",
    "endDate": "2021-03-02T23:59:59",
    "taskDuration": 1,
    "manuallyScheduled": true,
  },
  {
    "id": "ab96d5d2-04b8-42a1-b2eb-aa3d80c5bcfd",
    "name": "Critical Task Duration has grown or been significantly delayed",
    "startDate": "2021-03-03T00:00:00",
    "endDate": "2021-03-03T23:59:59",
    "taskDuration": 1,
    "manuallyScheduled": true,
  },
  {
    "id": "74207363-3804-4c07-964e-e309841972bd",
    "name": "Multiple, queued, critical tasks",
    "startDate": "2021-03-04T00:00:00",
    "endDate": "2021-03-04T23:59:59",
    "taskDuration": 1,
    "manuallyScheduled": true,
  },
  {
    "id": "a9ac09e5-57a5-41bf-92bb-54ef6b738c48",
    "name": "Update Project Start/End Dates",
    "startDate": "2021-02-26T00:00:00",
    "endDate": "2021-02-26T23:59:59",
    "taskDuration": 1,
    "manuallyScheduled": true,
  },
  {
    "id": "d535ed23-1692-171e-4f39-305d3b2aa6ca",
    "name": "Fill Segment Gaps",
    "startDate": "2021-03-08T00:00:00",
    "endDate": "2021-03-08T23:59:59",
    "taskDuration": 1,
    "manuallyScheduled": true,
  }
]
}
]},
});

gantt.project.commitAsync().then(async() => {

gantt.eventStore.loadDataAsync([
    {
        "id": "79d9b2d5-82bc-4e82-9e9f-a030d0463e27",
        "name": "Email Notifications & Auto-updates",
        "startDate": "2021-02-26T00:00:00",
        "endDate": "2021-03-22T23:59:59",
        "taskDuration": 17,
        "expanded": true,
        "manuallyScheduled": true,
        "children": [
          {
            "id": "9e09ccc8-f6c8-4fc6-a92d-c7d82587bae4",
            "name": "Daily Task Update Reminder",
            "startDate": "2021-03-22T00:00:00",
            "endDate": "2021-03-22T23:59:59",
            "taskDuration": 1,
            "manuallyScheduled": true,
          },
          {
            "id": "05b35d05-21b9-4a06-8898-d9b7f8efcca4",
            "name": "New Task Assigned to You",
            "startDate": "2021-03-01T00:00:00",
            "endDate": "2021-03-01T23:59:59",
            "taskDuration": 1,
            "manuallyScheduled": true,
          },
          {
            "id": "6f02b615-638d-4643-be59-78b0e7b787b9",
            "name": "New Actionable Task",
            "startDate": "2021-03-02T00:00:00",
            "endDate": "2021-03-02T23:59:59",
            "taskDuration": 1,
            "manuallyScheduled": true,
          },
          {
            "id": "ab96d5d2-04b8-42a1-b2eb-aa3d80c5bcfd",
            "name": "Critical Task Duration has grown or been significantly delayed",
            "startDate": "2021-03-03T00:00:00",
            "endDate": "2021-03-03T23:59:59",
            "taskDuration": 1,
            "manuallyScheduled": true,
          },
          {
            "id": "74207363-3804-4c07-964e-e309841972bd",
            "name": "Multiple, queued, critical tasks",
            "startDate": "2021-03-04T00:00:00",
            "endDate": "2021-03-04T23:59:59",
            "taskDuration": 1,
            "manuallyScheduled": true,
          },
          {
            "id": "a9ac09e5-57a5-41bf-92bb-54ef6b738c48",
            "name": "Update Project Start/End Dates",
            "startDate": "2021-02-26T00:00:00",
            "endDate": "2021-02-26T23:59:59",
            "taskDuration": 1,
            "manuallyScheduled": true,
          },
          {
            "id": "d535ed23-1692-171e-4f39-305d3b2aa6ca",
            "name": "Fill Segment Gaps",
            "startDate": "2021-03-08T00:00:00",
            "endDate": "2021-03-08T23:59:59",
            "taskDuration": 1,
            "manuallyScheduled": true,
          }
        ]
      },
]);
});

After the loadDataAsync() gets called, 'Daily Task Update Reminder' still has a duration of 17 even though the data provided contains a 1 day task.

Any thoughts / suggestions?

Thanks,
Rayudu


Post by saki »

Yes it looks it is the same or similar issue to https://github.com/bryntum/support/issues/2769. Read please my last comment on the ticket perhaps you can use it as a workaround until it gets fixed.


Post by rayudu.pasumarthy »

Hi Saki,

This seems to be happening when only either start date or end date changes (if both change, it works fine) for that task. Since 'duration' property is not changed in the new JSON, it restricts the task from expanding/shrinking as duration takes priority (nullifies the check of start date and end date).

Is it possible to give preference to start date/end date over duration?
OR
Can syncDataOnLoad not consider 'duration' and only depend on start date and end date for the true values?
OR
Can syncDataOnLoad update the 'duration' property when either dates change instead of checking if both have changed?

Thanks,
Rayudu.


Post by Maxim Gorkovsky »

Hi,
You can just remove duration from the incoming data, before passing it to loadDataAsync


Post by rayudu.pasumarthy »

Hi Maxim, thanks for your reply.

As in the JSON given in the first post, we are passing 'taskDuration' instead of 'duration' to make the end dates inclusive. But it seems that bryntum auto sets the duration in the background thereby causing syncDataOnLoad to not update correctly on start date / end date change. Can syncDataOnLoad not consider 'duration' and only depend on start date and end date for the true values?

Thanks,
Rayudu.


Post by Maxim Gorkovsky »

Can syncDataOnLoad not consider 'duration' and only depend on start date and end date for the true values?

This is how scheduling engine in gantt works. Every task has start, end and duration which are entangled. You can provide any 2 of them and remaining one will be recalculated. If you're providing all three, then end date is ignored and instead is recalculated from the start + duration.


Post by rayudu.pasumarthy »

Thanks Maxim for the info.
So is there any alternative to get the data to show properly before this ticket is fixed? It is inadequate to use syncDataOnLoad if the data does not show correctly even with the correct JSON data passed.

Thanks,
Rayudu.


Post by alex.l »

Hi rayudu.pasumarthy,

You could try to use startDate/endDate and avoid duration field as it discussed above. If it isn't applicable in your case, we have to wait for the fix. It's targeted on 4.3.0 version, so it will be there in one of the nearest releases.

All the best,
Alex


Post by rayudu.pasumarthy »

Hi Alex,

As in the JSON in the beginning of this post, we are avoiding duration and using only startDate/endDate but incorrect data is still shown.

Thanks,
Rayudu.


Post by alex.l »

Unfortunately, there is no quick workaround here. We have to wait the fix. Btw, discussion in the ticket says this bug is reproducible only with time like 23:59:59 , but I cannot be sure about your dataset since I don't know the root cause of the bug.

All the best,
Alex


Post Reply