Premium support for our pure JavaScript UI components


Post by srr »

Hello

I would like my resource utilization widget to consider the resource capacity when calculating utilization.

I have implemented a change using the getBarText function so that the resource utilization figure shows as a percentage of total availability, rather than number of hours used.

To give you an example scenario, I have resource "D1" which has 1 machine in it, and assigned to that resource I have a job which uses 8h of 8h available on Friday 9th June. Currently this shows 100% utilization correctly. If I increase the resource capacity to 2 machines, with the same job assigned to the resource, I want the utilization to show 50% (8h of 16h available), rather than 100%.

Is this possible? If so, can you point me in the right direction please?

Thank you


Post by alex.l »

Hi,

I have implemented a change using the getBarText function

So you want to change your code to have behaviour you described? Can you please share your code then?

All the best,
Alex


Post by srr »

Hi Alex,

I did wonder if I would need to amend my formula for calculating the percentage. If that is the case that's fine. I just wanted to check I wasn't overlooking some standard functionality that was already available.

Thanks


Post by arcady »

There is no capacity support out of the box I'm afraid. We have a feature request but we haven't started on it yet.

If you want to implement this yourself you basically need to override calculateAllocation method of ResourceAllocationInfo class.

class MyResourceAllocationInfo extends ResourceAllocationInfo {

    * calculateAllocation() {
        ....
    }

}

const project = new ProjectModel({
    resourceAllocationInfoClass : MyResourceAllocationInfo,
    ...
});

new ResourceUtilization({
    project,
    ....
});

FYI The upcoming v5.4.0 release (on alpha-1 stage now) includes refactored resource utilization view which gives some more public ways for customization:
here is a new guide sneak peek for the view: https://www.bryntum.com/products/gantt-next/docs/guide/SchedulerPro/resourceviews/resourceutilization

P.S. Or you could sponsor the feature development to push its priority on our TODO list. Please reach out sales at bryntum.com for a quote if that works for you


Post by srr »

Thanks arcady - as suggested I have implemented my own calculateAllocation method and all working as I need now.
Thanks for your help!


Post Reply