Premium support for our pure JavaScript UI components


Post by rahulranjan »

HI
We have any Reference about how fields let say late start late finish , or based or duration finish date is calculated. About all the calculated fields where i can see.

How it uses internally Scheduling Engine or chronograph . Does Brytumn gantt Interact Directly with Engine or Chronograph as mentioned in Docs - https://bryntum.github.io/chronograph/docs/modules/_src_chrono_graph_.html
https://bryntum.com/docs/gantt/engine/classes/_docs_src_getting_started_.gettingstartedguide.html

It seems it internally interacts. But i can check how this works behind the scene.


Post by pmiklashevich »

Please see the docs:
https://bryntum.com/docs/gantt/engine/classes/_lib_engine_quark_model_scheduler_pro_constrainedearlyeventmixin_.constrainedearlyeventmixin.html
https://bryntum.com/docs/gantt/engine/classes/_lib_engine_quark_model_gantt_constrainedlateeventmixin_.constrainedlateeventmixin.html

Yes, the gantt chart is a visual representing of the dataset calculated (scheduled) by the engine behind the scene.

You can also check out the basic feature guide:
https://bryntum.github.io/chronograph/docs/modules/_src_guides_basicfeatures_.html#basicfeaturesguide

Please explain your usecase, what exactly you're trying to achieve and we will try to help you. Cheers!

Pavlo Miklashevych
Sr. Frontend Developer


Post by rahulranjan »

HI pmiklashevich
Thanks for Response ,
Let us say when we change Duration or Finish Date field it must be impacting/ changing the other auto computed fields of Bryntum Gantt . So when you change the Duration fields in UI , it must sending the dataset to Scheduling Engine and Scheduling Engine Must be re-calculating / computing various fields. We want to know how it interacts with Schedule Engine from Gantt and how can i know what data are passed to Schedule Engine and What the Output we gets by Gantt. It must be interact in some or other way to Engine . How we can check the integration b/w gantt and Engine


Post by arcady »

https://www.bryntum.com/docs/gantt/engine/classes/_docs_src_getting_started_.gettingstartedguide.html

The Gantt models extend models provided by the Scheduling Engine. For example the https://www.bryntum.com/docs/gantt/#Gantt/model/TaskModel subclasses the Engine GanttEvent class.
Unfortunately it's not reflected in the docs yet (we have an internal ticket for that but it's not resolved so far).

So when you change a task field (duration field for example) you basically write to the Engine (to a graph built by the Engine).
That schedules a propagation process that is triggered asynchronously and that process recalculates related field values.


Post by rahulranjan »

arcady wrote: Fri Dec 11, 2020 11:15 am

https://www.bryntum.com/docs/gantt/engine/classes/_docs_src_getting_started_.gettingstartedguide.html

The Gantt models extend models provided by the Scheduling Engine. For example the https://www.bryntum.com/docs/gantt/#Gantt/model/TaskModel subclasses the Engine GanttEvent class.
Unfortunately it's not reflected in the docs yet (we have an internal ticket for that but it's not resolved so far).

So when you change a task field (duration field for example) you basically write to the Engine (to a graph built by the Engine).
That schedules a propagation process that is triggered asynchronously and that process recalculates related field values.

How call is made to Engine lib Internally from Gantt


Post by pmiklashevich »

If you look at TaskModel class in Gantt:

export default class TaskModel extends GanttEvent.derive(TimeSpan).mixin(PartOfProject, PercentDoneMixin) {

GanttEvent is imported from the Engine module.

import { GanttEvent } from '../../Engine/quark/model/gantt/GanttEvent.js';

And Gantt/lib/Engine/quark/model/gantt/GanttEvent.js is a compiled version of Gantt/lib/Engine/quark/model/gantt/GanttEvent.ts (typescript-like class). This is how inheritance work :)

Pavlo Miklashevych
Sr. Frontend Developer


Post by rahulranjan »

Hi
Thanks for reply
So In build folder i can't see any Engine folder how then Engine is interacted or data is send to Engine lib can we clear on this.


Post by rahulranjan »

Hi
Basically once i change dates let say start Date or let say scheduling Mode in UI how it goes to Engine what data set is taken into account any debug steps we can do for it


Post by pmiklashevich »

So In build folder i can't see any Engine folder how then Engine is interacted or data is sent to Engine lib can we clear on this

We do not distribute Engine as a standalone package. There is no protocol to communicate between Engine and Gantt. So it's not correct to imagine "Engine < = => Gantt" connection. Gantt extends the Engine. So this is what it looks like "Engine => Gantt => Your implementation", where Engine is the parent class, Gantt extends Engine and adds some functionality, and you can provide your own implementation by subclassing the Gantt classes and override method responsible for calculation. All the Engine API exposed to the Gantt. You can make sure it's true by checking the gantt.module.js file. Search for "class GanttEvent extends MixinAny", and you'll find one entity. This code is taken from the Engine (Engine/quark/model/gantt/GanttEvent.ts). So you can use the inheritance to implement your own calculation logic.

By the way, regarding to your question about possibility to run Engine on server. Due to the fact that Engine is not a standalone service, to calculate data on server you need to instantiate a ProjectModel on server. But there is no UI connected to the server to be used out of the box. If you want to reuse our Gantt UI, but calculate tasks on the server, you need to save the result calculated by the ProjectModel instantiated on server and pass it through Ajax request to the client. Then the client side engine will take care of the calculations and only sync data with backend. Therefore server side engine becomes redundant. Server side implementation can be useful if you don't need to visualize the data, but you need to schedule some data before let's say saving it to the database.

Basically once i change dates let say start Date or let say scheduling Mode in UI how it goes to Engine what data set is taken into account any debug steps we can do for it

To debug how Engine processes the data changes, you can set a breakpoint right before you set new data, and step in. For example, you can run this code in console of the Advanced demo:

(()=> {
  const task = gantt.taskStore.getById(11)
  debugger
  // step in to see how startDate field calculation works
  task.startDate = new Date();
})()

This is a short algorithm:

  • startDate setter sets the value to the Graph
  • commitAsync is scheduled
  • in a timeout doCommitAsync runs generators
  • * calculateStartDate generator calculates the date value (you can step in to see what mixins take a part in calculations)
  • the value returned by the generator is saved to the Graph
  • startDate getter returns the value from the Graph

You can see what fields have calculate[FieldName] (e.i. calculateStartDate) function in the Engine docs:
https://bryntum.com/docs/gantt/engine/classes/_lib_engine_quark_model_scheduler_basic_baseeventmixin_.baseeventmixin.html#calculatestartdate

To override Engine calculation you can override the generator function on the TaskModel. For example, in case of startDate, you can override * calculateStartDate.

class Task extends TaskModel {
    // shown here to let you step in here while debugging
    set startDate(value) {
        super.startDate = value;
    }

// shown here to let you step in here while debugging
get startDate() {
    return super.startDate;
}

// the generator function which is responsible for calculations
* calculateStartDate() {
    // debugger
    const calculatedDate = yield * super.calculateStartDate(...arguments);
    console.log(calculatedDate);
    return calculatedDate;
}
}

You can try the code above in Advanced demo (Gantt/examples/advanced/lib/Task.js)

This is general information about the Engine and the Gantt working together. You need to keep in mind, that by implementing a specific functionality and/or adjusting the engine implementation, you'll need to support that on your own. We cannot help with custom implementations in scope of the forum support. Only as a part of our professional services. If you find that some calculations are wrong and/or something is not taken into account, please report that to us, so we can fix the calculation. Please treat Engine override as any other overrides in your code.

Best regards,
Pavel

Pavlo Miklashevych
Sr. Frontend Developer


Post Reply