vis-timeline icon indicating copy to clipboard operation
vis-timeline copied to clipboard

Timeline: Group height is calculated based on hardcoded 'top' values and not on the items actual 'top' value.

Open MartinManev opened this issue 6 years ago • 1 comments

I'm trying to make a compact/expanded mode for the timeline. I can override the padding and font-size through CSS classes just fine, but not the top property. Actually it is possible to override the top property in the same manner, but it is not taken into consideration when calculating the group height. If I set the top property in item.style then it will be overriden by the script.

I haven't examined the internals in detail, but it seems like the top property is hardcoded and has the following values:

  • Depending on the timeline orientation the items in the first group will have a top value of 20.
  • If the stack option is set to false for the timeline, then the items in the first group will have a top value of 10 instead.
  • Items in subsequent groups will have a top value of 5.
  • Stacked items will have varying top values as needed.

What I want to achieve:

  • Do not treat the first group of items differently. All groups should have the same top value.
  • Ability to change the top property with CSS or 'item.style' and calculate the group height based on that.

Demo: https://jsfiddle.net/2Lakd7fp/

MartinManev avatar Nov 06 '19 08:11 MartinManev

I'm having the same problem. In my case, I have stacking turned off, so each group height should be equal, but the last group has an additional 5px of space that is hard to remove. (It's the last group for me, not the first, because I'm using the default orientation: bottom.)

It would be nice if there were settings like a margin around each item (so setting this to 0 would make the items flush with the containing row) and a marginToAxis for the extra 5px.

TheophileMot avatar Nov 18 '21 21:11 TheophileMot