Our state of the art Gantt chart


Post by vodyanitskiy »

Hi,

We are dealing with a scenario where we have 5000 tasks in input. The initial execution process runs smoothly and quickly. However, we encounter performance issues post this stage.

export const CustomComponent: FC<CustomComponentProps> = ({ ganttData }) => {
  const ganttProjectRef = useRef<BryntumGanttProjectModel>();
  const ganttRef = useRef<BryntumGantt>();

  // ...

  return (
    <>
      <BryntumGanttProjectModel
        ref={ganttProjectRef}
        tasks={ganttData.tasks}
        dependencies={ganttData.dependencies}
        calendars={ganttData.calendars}    
        resources={ganttData.resources}
        assignments={ganttData.resourceAssignments}
      />

      <BryntumGantt
        ref={ganttRef}
        ariaLabel="Gantt View"
        listeners={ganttListeners}
        project={ganttProjectRef}
        {...config}
      />
    </>
  )
}

If we externally manipulate the data in the CustomComponent, say through filtering or grouping, it results in alterations in the task list, causing the Gantt chart to freeze (possibly syncing data?).

We tried a different approach where we recreate the ProjectModel completely, and we decided to step away from the BryntumGanttProjectModel component.

useEffect(() => {
  const gantt = ganttRef?.current.instance;

  gantt.project = new ProjectModel({
    tasks: ganttData.tasks,
    dependencies: ganttData.dependencies,
    resources: ganttData.resources,
    assignments: ganttData.resourceAssignments,
    calendars: ganttData.calendars,    
  });
  }, [direction, ganttData]);
}

However, a problem arises. When dragging/changing tasks, we sync our store, which leads to recalculating the ganttData.tasks. This, in turn, results in the recreation of the ProjectModel. At this stage, it becomes quite a challenge to differentiate how the ganttData.tasks list has changed, whether from external filtering/grouping or whether it was prompted by a change in the Gantt itself.

We would greatly appreciate it if you could provide any possible resolutions for this issue we're facing. Are there any efficient methods to promptly refresh tasks, potentially bypassing extra synchronization? Thank you for your time and assistance!


Post by tasnim »

Hi,

Welcome to Bryntum Forum.

Would it be possible for you to upload a runnable test case with us so we can reproduce and debug it?
For refreshing gantt tasks you could use https://bryntum.com/products/gantt/docs/api/Grid/view/GridBase#function-refreshRows

Best regards,
Tasnim


Post by vodyanitskiy »

Hi,

I have prepared a simple example (link to the GitLab repo) with a Gantt chart where, upon clicking the filter button, we observe that the component freezes for an extended period of time and sometimes, the tab even crashes.

Would you mind taking a closer look into this matter? Thank you for your time and cooperation.


Post by tasnim »

Hi,

The way you are filtering data is not recommended. The best practice is to apply a filter to the store which is much more efficient.
You can see how fast it is the in the gif below

msedge_x3tj5KmGrU.gif
msedge_x3tj5KmGrU.gif (115.12 KiB) Viewed 187 times

Docs
https://bryntum.com/products/gantt/docs/api/Gantt/data/TaskStore#function-filter
for clearing filters use https://bryntum.com/products/gantt/docs/api/Gantt/data/TaskStore#function-clearFilters

Here is the code I used

        <BryntumGantt
            ref={ganttRef}
            project={ganttProjectRef}
            tbar={[
              {
                type : 'button',
                text : 'Filter',
                onAction({ source }) {
                  (source.up('gantt') as Gantt).taskStore.filter((record : TaskModelConfig) => record.percentDone === 100);
                }
              }
            ]}
        />
      </>

Hope it helps

Best regards,
Tasnim


Post by vodyanitskiy »

Thank you very much.

The thing is, our application is fully reactive, tasks can be modified, deleted, added via websockets, the filter is just one of the examples. For instance, tasks can be partially deleted by one user and the application should reactively respond to this fact for all other users. Also, the filter/grouping should be able to work with an extended set of fields (the fields specific to the rest of the application) which are not used by Gantt. How should we deal with such scenarios? Thank you!


Post by tasnim »

Hi,

We do have a demo regarding web sockets in Scheduler, implementing to gantt the process would be the same as the scheduler.
You can see the demo here https://bryntum.com/products/scheduler/examples/websockets/
You can check the code by clicking on the code icon in the top right corner

You can check the docs here about project events https://bryntum.com/products/gantt/docs/api/Gantt/model/ProjectModel#events
With these, you can listen to every event regarding the Gantt data.

project.on('eventName', () = { /* callback */ })

Hope this helps.

If you have any other questions or concerns please don't hesitate to reach out to us. We're here for your help 🙂

Best of luck :),
Tasnim


Post by vodyanitskiy »

I apologize if we seem to be on different pages, let me clarify our situation.

We’re utilizing Gantt within our application and we supply tasks to it via a React Gantt wrapper (using props). With this setup, the tasks are affected by various external services - filtering, web-sockets, grouping, ... However, we encounter a problem when we have a large volume of tasks, around 5000 for example. During synchronization of these tasks, Gantt begins to slow down noticeably. Our priority is to ensure these 5000 Gantt entries update rapidly and smoothly.

It’s important to note that Gantt is only a part of our application, which already has filtering, grouping, and other functionalities implemented.

We have provided early an example in the repository of how we work with Gantt in our application.

Could you please advise on a suitable solution for our workflow? Is it a viable approach to use React Gantt wrapper props to achieve our goal?


Post by ghulam.ghous »

Hi there,

I have debugged and figured out a solution that should work for you. If you delete the projectModel and replace it with a new one, its much faster. You can see in our bigdataset example how we have handle such large data replacements https://bryntum.com/products/gantt/examples/bigdataset/. Here's the updated version of your code:

bryntum-gantt-app.zip
(45.5 KiB) Downloaded 11 times

Hope it helps!

Regards,
Ghous


Post Reply