Premium support for our pure JavaScript UI components


Post by kevin.snps »

Hi Bryntum Team,
We would like to know how the height of the red line in resource histogram can be changed via code. Do we need to override any method to change the value of the red line(Business hours)?

Attachments
image (3).png
image (3).png (4.05 KiB) Viewed 907 times

Post by arcady »

The position is calculated based on the resource calendar. It basically shows the resource availability for the tick.

The values displayed by the histogram are calculated by the Scheduling Engine.
For each resource it builds ResourceAllocationInfo class instance which provides data to the histogram. The class source code can be found in Engine/quark/model/scheduler_pro/SchedulerProResourceMixin.ts file. So one can extend that class to implement any custom logic.

And ResourceHistogram class has renderRecordAllocationInfo method which gets called to render calculated data. So this can also be overridden to do some customization.


Post by kevin.snps »

Hi Arcady , Thanks for the information.
Could you let use know which variable or method does the business hour line depend on. We already override the resource info allocation to do the custom logic. But could you let us which variable or method to target.
Thank you for your time.


Post by arcady »

The method preparing the data is called calculateAllocation.
And here is the line of the method where the maximum allocation level is filled:

                    tickData.maxEffort          += intervalDuration //duration || 0

Post by kevin.snps »

Hi Arcady thanks for the information , it really helped us .
We would like to know if the maximum load value in the resource histogram can be changed.
Currently its fixed at 24 hours.

But suppose we use grams as metrics then there could be 100grams , 250grams in those cases the max load should be set appropriately
if we try to changed the tickData.maxEffort = 250 * (Unit value that is needed for resource histograms ) the red line disappears.

We have tried this to hours as well ,
if we try to pass in 30 hours as the interval duration (converted to Ms) and assign it to tickData.maxEffort. the red line disappears.

Is there a solution or a work around for this .
Thank you.


Post by arcady »

Resource histogram displays amount of time and not grams.
Bar heights represent time. Row heights represent time and equal timeaxis tick duration (so they depend on current zoom level). And the maximum allocation line also represents time..

If timeaxis tick represents a day then the row height matches 24 hours (plus some margin by default equal 10% of row height). If you multiply maxEffort by 250 then the resulting value will probably be greater than 24hrs and thus will not be displayed. It's just greater than the max that fits into the row height.


Post by arcady »

If you need to display grams then probably you don't need resource histogram since it hows resource effort allocation.

You can try building your own component. We have generic https://www.bryntum.com/docs/gantt/api/Core/widget/graph/Histogram that renders bars. It can be used to build rows.


Post by kevin.snps »

Hi arcady , thanks for the information.
Is there any example or any resource which points to how we can use just the histogram by itself . We want be able to display not only time axis (24hours) but also different unitns such as 100grams , 200 mtrs etx.
Is it possible by histogram widget and if so please let us know where we can find the reference to histogram code (In any of the examples


Post by alex.l »

Hi kevin.snps,

Unfortunately, there is no examples with Histogram graph itself, it's a base class that we used to build our "meaningful" for business logic histograms.
You can easily find the source code in Histogram.js file in our sources, as well as ResourceHistogram.js
please check lib/Core/widget/graph/Histogram.js and lib/SchedulerPro/view/ResourceHistogram.js
The methods you need to use/change to make your own calculations are mentioned by Arcady above.

If you need an assistance in development, you are welcome to contact our sales and hire us here https://www.bryntum.com/services

All the best,
Alex


Post by alex.l »

We will discuss internally if we can add an example of using Histogram with custom data.

All the best,
Alex


Post Reply