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

Long items disappear from group if data are set #1657

Open
dankop78 opened this issue Jun 21, 2023 · 3 comments · Fixed by SmartsquareGmbH/vis-timeline#2 · May be fixed by #1846
Open

Long items disappear from group if data are set #1657

dankop78 opened this issue Jun 21, 2023 · 3 comments · Fixed by SmartsquareGmbH/vis-timeline#2 · May be fixed by #1846

Comments

@dankop78
Copy link

Description

Long range items disappear from the timeline after data update if zoomed in so that the item start before visible range and ends after visible range.

Replication

For replication use the attached StackBlitz example.

  1. click the Show All, it zooms to range where all items are visible
  2. click the Set Data, items and groups are set and displayed properly
  3. click the Zoom to Failure, it zooms to range where the issue happens
  4. click the Set Data, items disappear but they should be displayed as they overlap the current range
  5. click the Show All, items are displayed again as the range has changed

If you replace step 4 by subsequent clicks on Set Groups and Set Items then the items disappear at first but then they are displayed again. This is a possible workaround for us. We could execute setItems() in timer to make the items re-appear. However it introduces unpleasant flickering :(

Root Cause Analysis

The error happens in method _updateItemsInRange. There is a Binary Search algorithm implementation that under some combination of items simply skips the visible item. Most likely due to optimization reasons the items are at first sorted by start date and then also by end date. Then the binary search is applied that looks for first visible item by start and then by both start and end dates. If no first visible item is found then others are skipped. The proper approach would be to evaluate each item and check if it overlaps with visible range.

@stappel
Copy link

stappel commented Sep 15, 2023

I have the same issue with my own page.
Long items which start before the start of the view date start, or sometimes not shown.

@jdmcleod
Copy link

Also having this issue. Any workarounds found yet?

ChristianKrebel added a commit to SmartsquareGmbH/vis-timeline that referenced this issue Dec 12, 2024
Remove binary search for items having an end time because items starting before range and ending after it were left out.

Fixes visjs#1657
ChristianKrebel added a commit to SmartsquareGmbH/vis-timeline that referenced this issue Dec 16, 2024
Remove binary search for items having an end time because items starting before range and ending after it were left out.

Fixes visjs#1657
@ChristianKrebel
Copy link

@stappel @jdmcleod @dankop78 If you still have the need for the fix I published a fork until the fix gets merged: https://www.npmjs.com/package/@smartsquaregmbh/vis-timeline

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants