Discuss anything related to web development but no technical support questions


Post by elucian »

Hello, we have a use case that looks almost exactly like the "Histogram" demo found here: https://bryntum.com/examples/gantt/resourcehistogram/

How our use-case differs from the example, is we use the gantt chart and have a 1:1 mapping of task <-> resource.

We would like to send ourresources data including total field with the total available number of items.

We are supplying to the project.resources.rows (as per the launch-saas.json example) with the following data structure

export type Resource = {
  id: string
  name: string
  total: number
  calendar: string | null
}

It seems like it should not be too far a stretch to use the task counts at a given time to show availability with the following simple equation for each row of the histogram

resource.total - [total number of tasks at a given time by resource.id].count

Is this possible with Bryntum Gantt?

Also, it seems that no matter what kind of data i give this thing, It always says "no records to display" in the histogram section


Post by Maxim Gorkovsky »

Hello.
Unfortunately, resource histogram doesn't accept pre-calculated data. Instead in uses Gantt project to calculate resource availability. If you have all the data calculated, I would recommend you to use Grid or Tree from Gantt distribution to show the values.


Post by Maxim Gorkovsky »

Could you provide more details about the expected behavior? A screenshot of the existing UI and things you're missing in our resource histogram would be helpful.


Post by elucian »

Hello Maxim, thank you for the reply.

Sorry I was not clear about my intention of what we require.

here is an image of what I am hoping to do. Let me clarify a bit in words too, I do not want to add "precalculated data" I was hoping that bryntum gantt could do this for me, as it has already done the work of bucketing the data.

  1. We would like to use a "total number" instead of 24h in the histogram (I used "5" in my example)
  2. We would like the histogram to calculate the total allocated resorce over a given time span, notice in my example that I want it to show 2/5 allocations while there are 2 "Beam" items allocated over that given period, when the first task ends, we would like it to drop to 1/5 allocations, and then to 0 when there are no allocations.

Seems like a very simple requirement, but I could be wrong. We are hoping this will save us from having to use another charting library and do all the calulcations ourselves.

Attachments
ganttstuff.jpg
ganttstuff.jpg (352.4 KiB) Viewed 2644 times

Post by arcady »

Hello,
It's doable but there is no magic configuration option for that out of the box I'm afraid. :)

Unfortunately the code building data for the histogram is private at the moment.
The dataset is collected by ResourceAllocationInfo class defined in lib/Engine/quark/model/scheduler_pro/SchedulerProResourceMixin.ts file.
The class has two input properties:

  • ticks - defines list of the timeaxis ticks, so the allocation is grouped by the ticks
  • resource - resource to collect data for

And it has one output property:

  • allocation - an array of ResourceAllocationInterval instances.

The allocation property value is calculated by calculateAllocation method. The method currently sums up working periods of time ..and you need it to aggregate number of assigned resources as I see.
So you need to subclass ResourceAllocationInfo and override its calculateAllocation method respectively.

Then to support that on UI level you need to subclass ResourceHistogram class and override its renderResourceHistogram method (also private unfortunately). Just copypaste its code and replace ResourceAllocationInfo.new with YourCustomResourceAllocationInfo.new to use your subclass.
After doing that the histogram will start showing dataset built by your custom class.

The above is of course a "long-story-short" version and when you start implementing that you'll have extra questions for sure. Please feel free to ask them here on the forum.

We have plans on changing the histogram in future releases to make it more configurable, but currently it's pretty tricky unfortunately.


Post by arcady »

p.s.
Another option worth mentioning is you can hire us for implementing a custom feature like that ..please contact sales at bryntum.com for a quote if that works for you.


Post by elucian »

Thanks for the replies, guys! I think this has answered my question.

It makes sense to me to just reach for another charts library at this time, rather than fight to make this one work. I appreciate all the time you put into answering this request!


Post Reply