Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Overlapping Events, Event Bar below other #70

Closed
martinfruehmorgen opened this issue May 9, 2022 · 17 comments
Closed

Overlapping Events, Event Bar below other #70

martinfruehmorgen opened this issue May 9, 2022 · 17 comments
Labels
enhancement New feature or request

Comments

@martinfruehmorgen
Copy link

martinfruehmorgen commented May 9, 2022

Hello,

Is there a way to have overlapping events in a row below each other and not visually overlapping?

Any hint how to achieve that, is appreciated!

edit: I see, it was discussed already
#19 (comment)
Any news regarding this?

Thanks
Martin

@V-Py
Copy link
Collaborator

V-Py commented May 16, 2022

Hello,
I implemented a custom algorithm to treat this case in one of my projects, but it's currently not integrated as a feature.
image

So tell me if it suits your need, and I'll see what I can do to integrate it properly.
Basically, for every tasks, the algorithm check if his "space" is free in the first children row, if not, check the second row, etc
So depending on the order of your tasks you might have different results, here the tasks are sorted DESC by start date.

@martinfruehmorgen
Copy link
Author

Hello,

And thanks!

I meant more, that if there are overlapping events f.e. in ligne1, the first (sorted by start date) should be on top of the 2nd and so on by expanding the row height. As I see Ligne 1 / 2 etc as a bookable resource for the events.

Any idea how to achieve this?

Thanks again,
Martin

@V-Py
Copy link
Collaborator

V-Py commented May 17, 2022

So you mean expanding the parent row height to stack the events on top of each others (when they overlap) and not using the children rows ?

I don't quite undersand your use case, the tasks in the main row are events, but the tasks in the children rows are resources for the events ?

@martinfruehmorgen
Copy link
Author

Hello,

No, I mean like the resource grid in Fullcalendar
https://fullcalendar.io/demos
then
"Resource Timeline"
You can drag several events onto one resource so they overlap.

The columns are resources (can be tree or not) and the corresponding line shows the events with the resource (for example a room or machine).

So to say not a Gantt chart but a resource booking timeline.

Thanks!
Martin

@V-Py
Copy link
Collaborator

V-Py commented May 17, 2022

Alright thanks for the resource, I understand way better now.
So you do want to have multiples tasks inside a single row stacking on top of each other, and the row height expanding, without the use of the children rows.

I'll have a look at it in the following days an see what I can do :)

@V-Py V-Py added the enhancement New feature or request label May 29, 2022
@martinfruehmorgen
Copy link
Author

Hello,

did you achieve any progress for this?

Thanks!
Martin

@V-Py
Copy link
Collaborator

V-Py commented Jul 4, 2022

Hello,
Have been kinda busy the last two weeks, and will still be the next two I think ..! 😭
I'm still handling blocking issues but don't have much time to add new feature right now.
Aiming for end of July/ start of August to implement this feature and few others awaiting 💪

@Edward-Ta
Copy link

Edward-Ta commented Aug 3, 2022

@martinfruehmorgen as a workaround this is what I have done to achieve something similar.

Line 1305 in index.js, I give each task an eventType and then alter its y position in the row depending upon that eventType.

/******************************************** EDWARDS CODE HERE *******************************/ 
 if(ctx[0].eventType === "jobslot"){
    ctx[6].y = ctx[6].y - 5
    } else if(ctx[0].eventType === "activity"){
    ctx[6].y = ctx[6].y +25
  }else if(ctx[0].eventType === "timesheet"){
    ctx[6].y = ctx[6].y +55
  }

Line 1351 in index.js then I change the height of each task to fit inside the row height.
ctx[1]/2.8 would change depending on the amount of rows you would want, ofcourse it could also be calculated as rowheight/task count.

  set_style(div1, "height", /*height*/ ctx[1]/2.8 + "px"); //EDWARDS CODE HERE

This is very buggy still, especially when I manipulate the window size or click between day and week.

image

@BlueFoxPrime
Copy link
Contributor

I am also interested in this. But its not very easy to implement. Especially with task reflections.
Maybe its an idea to use css grid for each row in the future.

@BlueFoxPrime
Copy link
Contributor

BlueFoxPrime commented Jan 18, 2023

@V-Py Have you made any progress on this? Any thoughts?
I was thinking of trying to remove the y-position property as it is and display tasks in css grid of the table row module (which would probably need changes). This would also mean that some form of the table module has to be integrated permanentely for the gantt to display properly. Here is a libary that seems to use css grid for inspiration on what I mean: https://github.com/cuire/svelte-grid-extended#static-grid

@Edward-Ta
Copy link

@BlueFoxPrime Just so I'm understanding this correctly, you mean each row is now in reality a big css grid?
And so tasks that are related would become rows in this grid, all within 1 related row in the Gantt Chart?

@BlueFoxPrime
Copy link
Contributor

BlueFoxPrime commented Jan 20, 2023

Currently each task is positioned absolute. My idea is to use a css grid and grid rows for y positions. Which in my view could significantly improve the performance and enable the requested feature. It would require core changes.

{#each rows as row}
  <div class="grid-row">
   {#each row.tasks as tasks}
       <div class="grid-item" use:dndaction>{task.id}</div>
        {/each}
   </div>
 {/each}

@martinfruehmorgen
Copy link
Author

Hi @BlueFoxPrime ,
Have you made any progress with this?
I am still struggling with displaying several events with overlapping dates in the same row.

Thanks,
Martin

ANovokmet added a commit that referenced this issue Oct 17, 2023
Configures how the overlapping tasks display

#70
@ANovokmet
Copy link
Owner

ANovokmet commented Oct 17, 2023

V4.2.0 has a new option. Gantt can be set with the layout: 'pack' option. When assigned overlapped tasks will display one over another. You can check it out in the demo: https://anovokmet.github.io/svelte-gantt/pack-layout

This feature can definitely be improved, so please give any feedback. For example, the row is not expanded, but the task's height shrinks - it would make sense to allow the layout where tasks stay the same size but the row expands. Also, the layout algorithm isn't the best - if multiple tasks overlap the same task but not each other, there is going to be some empty space.

@martinfruehmorgen
Copy link
Author

Thanks a lot! That's what I was trying to achieve. It would be great if the row would be expanded depending on the max amount of overlapping events in the timerange.

@ANovokmet
Copy link
Owner

v4.4.0 has the layout: "expand" option that expands the row when tasks overlap.

@martinfruehmorgen
Copy link
Author

Hello @ANovokmet ,
And thank you so much!
Will you update the repository here or is there another way to use the new version v4.4.0?

Thank you,
Martin

ANovokmet added a commit that referenced this issue Jun 24, 2024
ANovokmet added a commit that referenced this issue Jun 24, 2024
* fix: adjust style for different scrollbar sizes

* feat: rows of different heights #222

* feat: Add `expand` layout #70

* Fix #226

* github pages

* docs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

5 participants