Our state of the art Gantt chart


Post by lfrontoura »

Hi,

I have this project which has a parent task, both with fixed start dates. They keep sticking their position to the project start date. What could be wrong? In the picture I am pointing to what should be the right dates for the first child task. thanks.

export async function createProject(activity, startDate, project) {
  let json = {
    success: true,

project: {
  calendar: "general",
  startDate: "2020-1-13",
},

calendars: {
  rows: [
    {
      id: "general",
      name: "General",
      intervals: [
        {
          recurrentStartDate: "on Sat at 0:00",
          recurrentEndDate: "on Mon at 0:00",
          isWorking: false,
        },
      ],
      expanded: true,
      children: [
        {
          id: "business",
          name: "Business",
          hoursPerDay: 8,
          daysPerWeek: 5,
          daysPerMonth: 20,
          intervals: [
            {
              recurrentStartDate: "every weekday at 12:00",
              recurrentEndDate: "every weekday at 13:00",
              isWorking: false,
            },
            {
              recurrentStartDate: "every weekday at 17:00",
              recurrentEndDate: "every weekday at 08:00",
              isWorking: false,
            },
          ],
        },
        {
          id: "night",
          name: "Night shift",
          hoursPerDay: 8,
          daysPerWeek: 5,
          daysPerMonth: 20,
          intervals: [
            {
              recurrentStartDate: "every weekday at 6:00",
              recurrentEndDate: "every weekday at 22:00",
              isWorking: false,
            },
          ],
        },
      ],
    },
  ],
},

tasks: {},

dependencies: {
  rows: [
    {
      id: 1,
      fromTask: 0,
      toTask: 1,
      lag: 1,
    },
  ],
},

resources: {
  rows: [
    { id: 1, name: "Celia", city: "Barcelona", calendar: "general" },
    { id: 2, name: "Lee", city: "London", calendar: "general" },
    { id: 3, name: "Macy", city: "New York", calendar: "general" },
    { id: 4, name: "Madison", city: "Barcelona", calendar: "general" },
    { id: 5, name: "Rob", city: "Rome", calendar: "business" },
    { id: 6, name: "Dave", city: "Barcelona", calendar: "night" },
    { id: 7, name: "Dan", city: "London", calendar: "night" },
    { id: 8, name: "George", city: "New York", calendar: "general" },
    { id: 9, name: "Gloria", city: "Rome", calendar: "general" },
    { id: 10, name: "Henrik", city: "London", calendar: "business" },
  ],
},

assignments: {
  rows: [
    { id: 1, event: 11, resource: 1 },
    { id: 2, event: 12, resource: 1 },
    { id: 3, event: 12, resource: 9 },
    { id: 4, event: 13, resource: 2 },
    { id: 5, event: 13, resource: 3 },
    { id: 6, event: 13, resource: 6 },
    { id: 7, event: 13, resource: 7 },
    { id: 8, event: 13, resource: 8 },
    { id: 9, event: 21, resource: 5 },
    { id: 10, event: 21, resource: 9 },
    { id: 11, event: 22, resource: 8 },
    { id: 12, event: 25, resource: 3 },
  ],
},

timeRanges: {
  rows: [
     {
      id: 1,
      name: "Important date",
      startDate: "2019-01-30",
      duration: 0,
      durationUnit: "d",
      cls: "b-fa b-fa-diamond",
    },
  ],
},
  };

  const data = await getPartsList(activity, project);
  
let dependencies = []; let row = { id: -1, name: activity, percentDone: 0, startDate: startDate, expanded: true, children: [], }; for (const [i, v] of data.entries()) { let shipDate = ""; let delDate = ""; if (v.shipDate5 !== "") { shipDate = v.shipDate5; } else if (v.shipDate4 !== "") { shipDate = v.shipDate4; } else if (v.shipDate3 !== "") { shipDate = v.shipDate3; } else if (v.shipDate2 !== "") { shipDate = v.shipDate2; } else if (v.shipDate1 !== "") { shipDate = v.shipDate1; } if (v.delDate1 !== "") { delDate = v.delDate1; } else if (v.delDate2 !== "") { delDate = v.delDate2; } else if (v.delDate3 !== "") { delDate = v.delDate3; } else if (v.delDate4 !== "") { delDate = v.delDate4; } else if (v.delDate5 !== "") { delDate = v.delDate5; } console.log("ship date/del date", shipDate, delDate); row.children.push({ id: i, name: v.name, itemClass: v.itemClass, itemDesc: v.itemDesc, revision: v.revision, status: v.status, currRecOnSite: v.currRecOnSite, installDate: v.installDate, batch: v.batch, currentQty: v.currentQty, uom: v.uom, supplier: v.supplier, nonDefaulttProject: v.nonDefaulttProject, projectStock: v.projectStock, reqRecOnSite: v.reqRecOnSite, reqQty: v.reqQty < 0 ? "-" : v.reqQty > 0 ? "+" : "", suppTooLate: v.suppTooLate, percentDone: 0, shipDate1: v.shipDate1, shipDate2: v.shipDate2, shipDate3: v.shipDate3, shipDate4: v.shipDate4, shipDate5: v.shipDate5, delDate1: v.delDate1, delDate2: v.delDate2, delDate3: v.delDate3, delDate4: v.delDate4, delDate5: v.delDate5, startDate: shipDate, endDate: delDate, expanded: true, }); } json.tasks.rows = row; json.dependencies.rows = dependencies; console.log(json); const blob = new Blob([JSON.stringify(json)], { type: "application/json", }); const ganttconfigJson = new File([blob], "temp.json", { type: "application/json", lastModified: Date.now(), }); return URL.createObjectURL(ganttconfigJson); }
Attachments
wrong_start_end_date.PNG
wrong_start_end_date.PNG (179.25 KiB) Viewed 3030 times

Post by fabio.mazza »

Hi lfrontoura,

Sorry but I can not replicate your test case because there are things that depends of your app according your code, could you please create a simple test case with static data reproducing your problem? Then will be easier to reproduce.

For now, I would recommend you define on your model the new specific fields that you have on your gantt and when field is date, define the type and date format to make sure that is the problem.

Best regards,
Fabio


Post by lfrontoura »

Thanks for your answer. I am having the same issue in the advanced example. cheers.

Attachments
example.zip
(2.46 MiB) Downloaded 115 times

Post by lfrontoura »

Sorry, I sent you the wrong example to test, it should be this one.

Attachments
example_for_test.zip
(2.46 MiB) Downloaded 81 times

Post by fabio.mazza »

lfrontoura, running your example here I didn't see that your screen on first post:

Screen Shot 2020-09-25 at 13.57.51.png
Screen Shot 2020-09-25 at 13.57.51.png (78.09 KiB) Viewed 3011 times

Best regards,
Fabio


Post by lfrontoura »

Hi Fabio, thanks for taking some time to check it. I think this time I am sending it with the right json to test. cheers.

Attachments
tasks_wrong_dates.zip
(2.46 MiB) Downloaded 96 times

Post by pmiklashevich »

Hello,

That's expected behaviour. Tasks are scheduled following as soon as possible strategy always. There are 2 main options to shift a task to the right:

  1. Set corresponding constraint, for example "startnoearlierthan" or "muststarton" https://www.bryntum.com/docs/gantt/#Gantt/model/TaskModel#field-constraintType
    {
        "id": 1,
        "name": "011575-110-01600",
        "startDate": "2020-09-03",
        "endDate": "2020-11-05",
        "leaf": true,
        "constraintType": "startnoearlierthan",
        "constraintDate": "2020-09-03"
    },
    
    Снимок экрана 2020-09-28 в 11.00.37.png
    Снимок экрана 2020-09-28 в 11.00.37.png (385.9 KiB) Viewed 2989 times
  2. Exclude task from Scheduling process by setting "manuallyScheduled" field to true.
    https://www.bryntum.com/docs/gantt/#Gantt/model/TaskModel#field-manuallyScheduled
    {
        "id": 2,
        "name": "011575-110-01650",
        "startDate": "2020-09-03",
        "endDate": "2020-11-05",
        "leaf": true,
        "manuallyScheduled": true
    },
    
    Снимок экрана 2020-09-28 в 11.01.20.png
    Снимок экрана 2020-09-28 в 11.01.20.png (336.71 KiB) Viewed 2989 times
    Снимок экрана 2020-09-28 в 11.01.53.png
    Снимок экрана 2020-09-28 в 11.01.53.png (338.91 KiB) Viewed 2989 times

Best regards,
Pavel

P.S. We will have a guide about tasks scheduling in the docs of the upcoming 4.0 release. Stay tuned!

Pavlo Miklashevych
Sr. Frontend Developer


Post Reply