Our state of the art Gantt chart


Post by sanjeev.r »

As I understand currently WBS progress is based on completedDuration / totalDuration. I want to use a different formula for the progress calculation. I want to assign weightage (manully) on each task and then use that in WBS progress calculation.

See the example attached, I want to show the WBS % complete which I am calculating in the Gantt View, not the default one
Custom WBS Progress Calculation.JPG
Custom WBS Progress Calculation.JPG (41.36 KiB) Viewed 1404 times

Post by sanjeev.r »

This went to the wrong forum, this is for Bryntum Gantt. Please move this to correct group

Post by pmiklashevich »

Hello,

This is not supported out of the box. All calculations are done in the SchedulingEngine. Please see lib/Engine/data/model/event/HasPercentDone.ts. You can try to set `autoCalculatePercentDoneForParentTasks` to false and subscribe to store update and calculate percent done manually. Or you can create your own HasPercentDone mixin, implement all calculation in it, compile it to JS, extend Task model and mix your own mixin there. Unfortunately we don't have guides yet to teach you how to customize our Scheduling Engine, but they are coming. Here is the ticket: https://app.assembla.com/spaces/bryntum/tickets/9024-create-a-guide-to-show-custom-calculation-of-percent-done-field-by-changing/details

Best,
Pavel

Pavlo Miklashevych
Sr. Frontend Developer


Post by Qwerty »

Hi Pavel,

We are also looking for a way to change the progress logic, hopefully without making any changes to the library code.
What do you think about having a way to pass in a function for progress calculation while creating an instance similar to how you can pass a function for cell rendering.

Post by pmiklashevich »

Hello,

It's supported! You can subclass TaskModel and override calculatePercentDone function. For example, lets modify TaskEditor example (examples/taskeditor/app.js) to set percent done to 0 for parent tasks:
import '../../lib/Gantt/column/PercentDoneColumn.js';

class MyModel extends TaskModel {
    * calculatePercentDone (proposedValue) {
        // call parent function to get original calculation result
        let value = yield* super.calculatePercentDone(proposedValue);
        console.log(this.name, proposedValue, value);
        return this.isParent ? 0 : value;
    }
}

const gantt = new Gantt({
    ....
    columns : [
        { type : 'name', field : 'name', text : 'Name', width : 250 },
        { type : 'percentdone' }
    ],
    ....
});
2019-08-30_1319.png
2019-08-30_1319.png (368.5 KiB) Viewed 1310 times
Best,
Pavel

Pavlo Miklashevych
Sr. Frontend Developer


Post Reply