mermaid-js / mermaid

Generation of diagrams like flowcharts or sequence diagrams from text in a similar manner as markdown
https://mermaid.js.org
MIT License
71.53k stars 6.48k forks source link

Define available hours in Gantt chart to allow proper usage of hour-tasks #1555

Open mxschons opened 4 years ago

mxschons commented 4 years ago

Is your feature request related to a problem? Please describe. I want to use the Gantt chart for both tasks that will stretch over multiple days and some that only last for hours. Currently days last 24h which leads to 6 4h tasks in one day when they follow each other sequentally. It seems reasonable to only have 8 available hours per day for task planning (or something in this area). So in summary working with tasks that last hours will create wrong estimates for when I will finish my tasks

Describe the solution you'd like I would like to be able to set my available hours per day e.g. 2, 4, 8 or 12 (ideally for each day) and define how many hours a 1day task has. The benefit here is that it would scale well with smaller projects that only have been allocated x hours. I could see for instance, that a 1d task (defined with 1d = 8h) would stretch over 2 days in a 4hour work day chart.

Describe alternatives you've considered Alternatives include allowing me to write "0.5d" or "0.25d" instead. I could think of my 4 hour task as a 0.5 day task and Mermaid in the background generates a 12h block. Similarly for 2h and 0.25 days => 6h block. This would probably be an easier fix but will lack customizability.

Additional context Professional Gantt chart software often has these capabilities and it creates a much better planning experience.

riyaadh-abrahams commented 2 years ago

HI

I was struggling with this and think I finally have it working

gantt
    title A Gantt Diagram
    dateFormat  YYYY-MM-DD HH:mm
    axisFormat %H:%M
    section Section
    A task             :a1, 2014-01-01 14:00, 270m
    Late Task          :done, 2014-01-01 13:00, 100m
    6 Hours task       :done, 2014-01-01 08:00, 6h
revolter commented 2 years ago

Is the implementation needed for this complex?

RobSeder commented 2 years ago

Example

Here's another example:

gantt
    title Project Planning by Person-Hours
    section Research
        Vendor Research       :vr, 2022-05-15 08:00, 20h
        Onboarding              :co, after vr, 15h
    section Consultant Work
        Analysis              :a1, after co, 80h
        Documentation         :after a1, 60h

with something like this for code:

gantt
    title Project Planning by Person-Hours
    section Research
        Vendor Research       :vr, 2022-05-15 08:00, 20h
        Onboarding            :co, after vr, 15h
    section Consultant Work
        Analysis              :a1, after co, 80h
        Documentation         :after a1, 60h

So, the idea is that you'd want to say "this item will take 20 hours" which means 20 WORKING hours, meaning 8 hours a day typically. Or for people on a 4 Day Workweek, a 10-hour work day. So, being able to set working hours for the exclude property would be useful for sure.

However, how it currently works is this seems to count full, 24-hour days, as if the worker is working 24-hours per day.


Potential Solution

What comes to mind for me, which would likely be the easiest to implement, but not the most elegant - is to just allow setting working hours by day of week. For example:

gantt
    title Project Planning by Person-Hours
    weekstartday Sunday
    availablehours 0,8,8,8,8,8,0
    ...
thiagoolsilva commented 1 year ago

@RobSeder any update for your solution? I'd love to solve this problem but I don't have any success to solve the related problem with my Gantt diagram.

RobSeder commented 1 year ago

@thiagoolsilva no, sorry. This is going to have to be something that is supported in the library, itself. I don't have any workarounds either.

thiagoolsilva commented 1 year ago

Thanks

jgreywolf commented 1 year ago

This is approved, but we need someone to take it on :)

robinfehr commented 1 year ago

that would be very useful indeed! i just found out that isn't working after I've put in quite some time into a bigger chart - wrongfully assuming thus far that this for sure must be a default feature.

kraxner commented 3 months ago

This seems to be related to #4060, and in this case will be resolved as well by #5403