Skip to content
This repository has been archived by the owner on Jul 29, 2019. It is now read-only.

Clustering of Timeline Items #3859

Open
rmdeluca opened this issue Mar 8, 2018 · 7 comments
Open

Clustering of Timeline Items #3859

rmdeluca opened this issue Mar 8, 2018 · 7 comments

Comments

@rmdeluca
Copy link

rmdeluca commented Mar 8, 2018

Will clustering of timeline items ever be supported again? Issue #242 was closed but the example given is no longer relevant to the current code base e.g. "Timeline.ClusterGenerator" does not exist any more, so the blog entry by @iftekharuli is useless for the current version of vis.js :/

@ryanarnell
Copy link

ryanarnell commented Mar 8, 2018

Sorry to hear. I have a stand alone version which is derived from vis.js older version I guess? https://github.com/ryanarnell/timeline Feel free to fork or whatever :) hope this helps a little..

@agent-z28
Copy link

Do you have an working example?

@rmdeluca
Copy link
Author

rmdeluca commented Mar 31, 2018

@agenterp I had to make a few modifications to the 4.21 source to get clustering working well in the Timeline:

  1. Modifying Group.js and a few other pieces to cluster items that are on top of each other (as opposed to stacking them). There is no clustering support, so I had to add my own. It's a pretty straightforward "determine which items overlap and stick them all in a bin, render only that bin using a custom template function."

  2. Adding a "SimpleItem" item type that renders as a single DIV so I don't have to fight the standard item's nested CSS to get icons to display properly.

  3. Overriding _updateDomComponentsSizes() in my new "SimpleItem" to allow use of a custom function to determine the item's size that doesn't use offsetWidth and offsetHeight. Accessing those properties before actually rendering forces the entire timeline to be laid out again, which chokes redraws when there are 10s of thousands of items potentially visible before clustering. Without this optimization, the timeline is still way too slow.

@VitalyVrublevskyy
Copy link

+1

@DrorElg
Copy link

DrorElg commented May 24, 2018

+1

@DrorElg
Copy link

DrorElg commented May 27, 2018

Hi,
found something online that helped me implement it so I am sharing...
this is a working example of clustering class
https://codepen.io/anon/pen/OZYwQN
*if it doesn't work change the vis.js and vis .css references to some working CDN
https://cdnjs.cloudflare.com/ajax/libs/vis/4.21.0/vis.css
https://cdnjs.cloudflare.com/ajax/libs/vis/4.21.0/vis.js

credit to CAPTAIN ANONYMOUS ;) thanks

@DavidSpackman
Copy link

@rmdeluca Did you have any source code for the modifications you made to the 4.21 source to get clustering working well in the Timeline?
Thank you.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants